Skip to content

Set DataFlowIssue as NullAway suppression name alias #4779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/src/test/java/example/session/HttpTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean supportsParameter(ParameterContext parameterContext, ExtensionCon
}

//end::user_guide[]
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
//tag::user_guide[]
@Override
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class SharedResourceDemo {

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
//tag::user_guide[]
@Test
void runBothCustomEnginesTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void beforeTestExecution(ExtensionContext context) {
}

//end::user_guide[]
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
//tag::user_guide[]
@Override
public void afterTestExecution(ExtensionContext context) {
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ mockito-bom = { module = "org.mockito:mockito-bom", version = "5.18.0" }
mockito-core = { module = "org.mockito:mockito-core" }
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter" }
nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" }
nullaway = { module = "com.uber.nullaway:nullaway", version = "0.12.7" }
# FIXME replace with release
nullaway = { module = "com.uber.nullaway:nullaway", version = "0.12.8-SNAPSHOT" }
opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" }
openTestReporting-cli = { module = "org.opentest4j.reporting:open-test-reporting-cli", version.ref = "openTestReporting" }
openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ tasks.withType<JavaCompile>().configureEach {
isJSpecifyMode = true
customContractAnnotations.add("org.junit.platform.commons.annotation.Contract")
checkContracts = true
// FIXME a new gradle-nullaway-plugin version is needed for a proper DSL
checkOptions.put("NullAway:SuppressionNameAliases", "DataFlowIssue")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private boolean invokeConditionMethod(Method method, ExtensionContext context) {
return invokeMethod(method, context, testInstance);
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
private static boolean invokeMethod(Method method, ExtensionContext context, @Nullable Object testInstance) {
if (method.getParameterCount() == 0) {
return (boolean) ReflectionSupport.invokeMethod(method, testInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@
*/
class AssertAllAssertionsTests {

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void assertAllWithNullExecutableArray() {
assertPrecondition("executables array must not be null or empty", () -> assertAll((Executable[]) null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void assertAllWithNullExecutableCollection() {
assertPrecondition("executables collection must not be null", () -> assertAll((Collection<Executable>) null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void assertAllWithNullExecutableStream() {
assertPrecondition("executables stream must not be null", () -> assertAll((Stream<Executable>) null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void assertAllWithNullInExecutableArray() {
assertPrecondition("individual executables must not be null", () -> assertAll((Executable) null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void assertLinesMatchUsingFastForwardMarkerWithLimit3() {
}

@Test
@SuppressWarnings({ "unchecked", "rawtypes", "DataFlowIssue", "NullAway" })
@SuppressWarnings({ "unchecked", "rawtypes", "DataFlowIssue" })
void assertLinesMatchWithNullFails() {
assertThrows(PreconditionViolationException.class, () -> assertLinesMatch(null, (List) null));
assertThrows(PreconditionViolationException.class, () -> assertLinesMatch(null, Collections.emptyList()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DynamicTestTests {

private final List<@Nullable String> assertedValues = new ArrayList<>();

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void streamFromStreamPreconditions() {
ThrowingConsumer<Object> testExecutor = input -> {
Expand All @@ -58,7 +58,7 @@ void streamFromStreamPreconditions() {
() -> DynamicTest.stream(Stream.empty(), displayNameGenerator, null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void streamFromIteratorPreconditions() {
ThrowingConsumer<Object> testExecutor = input -> {
Expand All @@ -73,7 +73,7 @@ void streamFromIteratorPreconditions() {
() -> DynamicTest.stream(emptyIterator(), displayNameGenerator, null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void streamFromStreamWithNamesPreconditions() {
ThrowingConsumer<Object> testExecutor = input -> {
Expand All @@ -84,7 +84,7 @@ void streamFromStreamWithNamesPreconditions() {
assertThrows(PreconditionViolationException.class, () -> DynamicTest.stream(Stream.empty(), null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void streamFromIteratorWithNamesPreconditions() {
ThrowingConsumer<Object> testExecutor = input -> {
Expand All @@ -95,14 +95,14 @@ void streamFromIteratorWithNamesPreconditions() {
assertThrows(PreconditionViolationException.class, () -> DynamicTest.stream(emptyIterator(), null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void streamFromStreamWithNamedExecutablesPreconditions() {
assertThrows(PreconditionViolationException.class,
() -> DynamicTest.stream((Stream<DummyNamedExecutableForTests>) null));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void streamFromIteratorWithNamedExecutablesPreconditions() {
assertThrows(PreconditionViolationException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void failWithNullString() {
}
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void failWithNullMessageSupplier() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void parseWithInvalidMediaType() {
assertEquals("Invalid media type: 'invalid'", exception.getMessage());
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void parseWithNullMediaType() {
var exception = assertThrows(PreconditionViolationException.class, () -> MediaType.parse(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void succeedingTest(TestReporter reporter) {
file -> Files.writeString(file, "succeedingTest"));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void invalidReportData(TestReporter reporter) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DefaultJupiterConfigurationTests {

private static final String KEY = DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME;

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void getDefaultTestInstanceLifecyclePreconditions() {
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class NestedTestCase {

}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
static class NullDisplayNameGenerator implements DisplayNameGenerator {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void returnsNamespaceAwareStore() {
assertNotNull(adapter);
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void throwsExceptionWhenNamespaceIsNull() {
LauncherStoreFacade facade = new LauncherStoreFacade(requestLevelStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TestInstanceLifecycleUtilsTests {

private static final String KEY = DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME;

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void getTestInstanceLifecyclePreconditions() {
PreconditionViolationException exception = assertThrows(PreconditionViolationException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void onlyConsiderParameterResolversThatSupportAParticularParameter() {
assertThat(arguments).containsExactly("something");
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void passContextInformationToParameterResolverMethods() {
anyTestMethodWithAtLeastOneParameter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void factoryReturnsDirectoryOnNonDefaultFileSystemWithPath() throws IOException
delete(closeablePath.get());
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@DisplayName("fails if the factory returns null")
@ParameterizedTest
@ElementTypeSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public void orderMethods(MethodOrdererContext context) {
context.getMethodDescriptors().set(1, createMethodDescriptorImpersonator(method2));
}

@SuppressWarnings({ "unchecked", "DataFlowIssue" })
@SuppressWarnings("unchecked")
static <T> T createMethodDescriptorImpersonator(MethodDescriptor method) {
MethodDescriptor stub = new MethodDescriptor() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void doesNotSupportCustomDefaultTempDirFactoryNotReturningDirectory() {

private static class FactoryNotReturningDirectory implements TempDirFactory {

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Override
public Path createTempDirectory(AnnotatedElementContext elementContext, ExtensionContext extensionContext) {
return null;
Expand Down Expand Up @@ -1475,7 +1475,7 @@ void test(@SuppressWarnings("unused") @TempDir(factory = Factory.class) Path tem
// never called
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
private static class Factory implements TempDirFactory {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ private static class LegacyInstanceFactory extends AbstractTestInstanceFactory {
*/
private static class NullTestInstanceFactory implements TestInstanceFactory {

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Override
public Object createTestInstance(TestInstanceFactoryContext factoryContext, ExtensionContext extensionContext) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TestReporterParameterResolverTests {

TestReporterParameterResolver resolver = new TestReporterParameterResolver();

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void supports() {
Parameter parameter1 = findParameterOfMethod("methodWithTestReporterParameter", TestReporter.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void createExceptionWithMethodSignatureTimeoutAndThrowable() {
.hasSuppressedException(suppressedException);
}

@SuppressWarnings({ "DataFlowIssue", "NullAway", "ThrowableNotThrown" })
@SuppressWarnings({ "DataFlowIssue", "ThrowableNotThrown" })
@Nested
@DisplayName("throws exception when")
class ThrowException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ void setUp() {
timeoutInvocationFactory = new TimeoutInvocationFactory(store);
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
@DisplayName("throws exception when null store is provided on create")
void shouldThrowExceptionWhenInstantiatingWithNullStore() {
assertThatThrownBy(() -> new TimeoutInvocationFactory(null)) //
.hasMessage("store must not be null");
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
@DisplayName("throws exception when null timeout thread mode is provided on create")
void shouldThrowExceptionWhenNullTimeoutThreadModeIsProvidedWhenCreate() {
assertThatThrownBy(() -> timeoutInvocationFactory.create(null, parameters)) //
.hasMessage("thread mode must not be null");
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
@DisplayName("throws exception when null timeout invocation parameters is provided on create")
void shouldThrowExceptionWhenNullTimeoutInvocationParametersIsProvidedWhenCreate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class DefaultArgumentsAccessorTests {

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void argumentsMustNotBeNull() {
assertThrows(PreconditionViolationException.class, () -> defaultArgumentsAccessor(1, (Object[]) null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class UnitTests {
/**
* @since 5.8
*/
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void preconditions() {
assertThatExceptionOfType(PreconditionViolationException.class)//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected Stream<? extends Arguments> provideArguments(
}
};

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
@DisplayName("should throw exception when null annotation is provided to accept method")
void shouldThrowExceptionWhenNullAnnotationIsProvidedToAccept() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ private static Object[] array(Object... objects) {
return provider.provideArguments(mock(), extensionContext).map(Arguments::get);
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
private DefaultExecutableInvoker getExecutableInvoker(ExtensionContext extensionContext) {
return new DefaultExecutableInvoker(extensionContext, extensionRegistry);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void failedTriesCanBeTransformed() throws Exception {
assertThat(exception.get()).isSameAs(cause);
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void successfulTriesCanStoreNull() throws Exception {
var success = Try.success(null);
Expand Down Expand Up @@ -101,7 +101,7 @@ void triesWithSameContentAreEqual() {
assertThat(failure).isEqualTo(Try.failure(cause));
}

@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
@Test
void methodPreconditionsAreChecked() {
assertThrows(JUnitException.class, () -> Try.call(null));
Expand Down
Loading
Loading