Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments. Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit. Issue: SPR-15540
This commit is contained in:
@@ -529,8 +529,7 @@ public class CciTemplateTests {
|
||||
given(interaction.execute(interactionSpec, inputOutputRecord)).willReturn(null);
|
||||
|
||||
CciTemplate ct = new CciTemplate(connectionFactory);
|
||||
Record tmpOutputRecord = ct.execute(interactionSpec,
|
||||
inputOutputRecord);
|
||||
Record tmpOutputRecord = ct.execute(interactionSpec, inputOutputRecord);
|
||||
assertNull(tmpOutputRecord);
|
||||
|
||||
verify(interaction).execute(interactionSpec, inputOutputRecord);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,11 +38,11 @@ public class TransactionSupportTests {
|
||||
PlatformTransactionManager tm = new TestTransactionManager(false, true);
|
||||
DefaultTransactionStatus status1 = (DefaultTransactionStatus)
|
||||
tm.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_SUPPORTS));
|
||||
assertTrue("Must not have transaction", status1.getTransaction() == null);
|
||||
assertFalse("Must not have transaction", status1.hasTransaction());
|
||||
|
||||
DefaultTransactionStatus status2 = (DefaultTransactionStatus)
|
||||
tm.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED));
|
||||
assertTrue("Must have transaction", status2.getTransaction() != null);
|
||||
assertTrue("Must have transaction", status2.hasTransaction());
|
||||
assertTrue("Must be new transaction", status2.isNewTransaction());
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,16 +52,6 @@ public class TransactionAttributeSourceTests {
|
||||
assertTrue(TransactionDefinition.PROPAGATION_SUPPORTS == ta.getPropagationBehavior());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchAlwaysTransactionAttributeSourceWithNulls() throws Exception {
|
||||
MatchAlwaysTransactionAttributeSource tas = new MatchAlwaysTransactionAttributeSource();
|
||||
TransactionDefinition definition = tas.getTransactionAttribute(null, null);
|
||||
assertEquals(TransactionDefinition.PROPAGATION_REQUIRED, definition.getPropagationBehavior());
|
||||
assertEquals(TransactionDefinition.ISOLATION_DEFAULT, definition.getIsolationLevel());
|
||||
assertEquals(TransactionDefinition.TIMEOUT_DEFAULT, definition.getTimeout());
|
||||
assertFalse(definition.isReadOnly());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nameMatchTransactionAttributeSourceWithStarAtStartOfMethodName()
|
||||
throws NoSuchMethodException {
|
||||
|
||||
Reference in New Issue
Block a user