Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -40,7 +40,7 @@ public class DataAccessUtilsTests {
|
||||
|
||||
@Test
|
||||
public void withEmptyCollection() {
|
||||
Collection<String> col = new HashSet<String>();
|
||||
Collection<String> col = new HashSet<>();
|
||||
|
||||
assertNull(DataAccessUtils.uniqueResult(col));
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DataAccessUtilsTests {
|
||||
|
||||
@Test
|
||||
public void withTooLargeCollection() {
|
||||
Collection<String> col = new HashSet<String>(2);
|
||||
Collection<String> col = new HashSet<>(2);
|
||||
col.add("test1");
|
||||
col.add("test2");
|
||||
|
||||
@@ -144,7 +144,7 @@ public class DataAccessUtilsTests {
|
||||
|
||||
@Test
|
||||
public void withInteger() {
|
||||
Collection<Integer> col = new HashSet<Integer>(1);
|
||||
Collection<Integer> col = new HashSet<>(1);
|
||||
col.add(5);
|
||||
|
||||
assertEquals(Integer.valueOf(5), DataAccessUtils.uniqueResult(col));
|
||||
@@ -158,7 +158,7 @@ public class DataAccessUtilsTests {
|
||||
@Test
|
||||
public void withSameIntegerInstanceTwice() {
|
||||
Integer i = 5;
|
||||
Collection<Integer> col = new ArrayList<Integer>(1);
|
||||
Collection<Integer> col = new ArrayList<>(1);
|
||||
col.add(i);
|
||||
col.add(i);
|
||||
|
||||
@@ -172,7 +172,7 @@ public class DataAccessUtilsTests {
|
||||
|
||||
@Test
|
||||
public void withEquivalentIntegerInstanceTwice() {
|
||||
Collection<Integer> col = new ArrayList<Integer>(2);
|
||||
Collection<Integer> col = new ArrayList<>(2);
|
||||
col.add(new Integer(5));
|
||||
col.add(new Integer(5));
|
||||
|
||||
@@ -189,7 +189,7 @@ public class DataAccessUtilsTests {
|
||||
|
||||
@Test
|
||||
public void withLong() {
|
||||
Collection<Long> col = new HashSet<Long>(1);
|
||||
Collection<Long> col = new HashSet<>(1);
|
||||
col.add(5L);
|
||||
|
||||
assertEquals(Long.valueOf(5L), DataAccessUtils.uniqueResult(col));
|
||||
@@ -202,7 +202,7 @@ public class DataAccessUtilsTests {
|
||||
|
||||
@Test
|
||||
public void withString() {
|
||||
Collection<String> col = new HashSet<String>(1);
|
||||
Collection<String> col = new HashSet<>(1);
|
||||
col.add("test1");
|
||||
|
||||
assertEquals("test1", DataAccessUtils.uniqueResult(col));
|
||||
@@ -229,7 +229,7 @@ public class DataAccessUtilsTests {
|
||||
@Test
|
||||
public void withDate() {
|
||||
Date date = new Date();
|
||||
Collection<Date> col = new HashSet<Date>(1);
|
||||
Collection<Date> col = new HashSet<>(1);
|
||||
col.add(date);
|
||||
|
||||
assertEquals(date, DataAccessUtils.uniqueResult(col));
|
||||
@@ -276,7 +276,7 @@ public class DataAccessUtilsTests {
|
||||
/**
|
||||
* in to out
|
||||
*/
|
||||
private Map<RuntimeException,RuntimeException> translations = new HashMap<RuntimeException,RuntimeException>();
|
||||
private Map<RuntimeException,RuntimeException> translations = new HashMap<>();
|
||||
|
||||
public void addTranslation(RuntimeException in, RuntimeException out) {
|
||||
this.translations.put(in, out);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -28,7 +28,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class MapTransactionAttributeSource extends AbstractFallbackTransactionAttributeSource {
|
||||
|
||||
private final Map<Object, TransactionAttribute> attributeMap = new HashMap<Object, TransactionAttribute>();
|
||||
private final Map<Object, TransactionAttribute> attributeMap = new HashMap<>();
|
||||
|
||||
|
||||
public void register(Method method, TransactionAttribute txAtt) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -51,7 +51,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
*/
|
||||
@Test
|
||||
public void testRuleForRollbackOnChecked() {
|
||||
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> list = new LinkedList<>();
|
||||
list.add(new RollbackRuleAttribute(IOException.class.getName()));
|
||||
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
|
||||
@Test
|
||||
public void testRuleForCommitOnUnchecked() {
|
||||
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> list = new LinkedList<>();
|
||||
list.add(new NoRollbackRuleAttribute(MyRuntimeException.class.getName()));
|
||||
list.add(new RollbackRuleAttribute(IOException.class.getName()));
|
||||
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
|
||||
@@ -79,7 +79,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
|
||||
@Test
|
||||
public void testRuleForSelectiveRollbackOnCheckedWithString() {
|
||||
List<RollbackRuleAttribute> l = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> l = new LinkedList<>();
|
||||
l.add(new RollbackRuleAttribute(java.rmi.RemoteException.class.getName()));
|
||||
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, l);
|
||||
doTestRuleForSelectiveRollbackOnChecked(rta);
|
||||
@@ -106,7 +106,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
*/
|
||||
@Test
|
||||
public void testRuleForCommitOnSubclassOfChecked() {
|
||||
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> list = new LinkedList<>();
|
||||
// Note that it's important to ensure that we have this as
|
||||
// a FQN: otherwise it will match everything!
|
||||
list.add(new RollbackRuleAttribute("java.lang.Exception"));
|
||||
@@ -121,7 +121,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
|
||||
@Test
|
||||
public void testRollbackNever() {
|
||||
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> list = new LinkedList<>();
|
||||
list.add(new NoRollbackRuleAttribute("Throwable"));
|
||||
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
|
||||
|
||||
@@ -134,7 +134,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
|
||||
@Test
|
||||
public void testToStringMatchesEditor() {
|
||||
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> list = new LinkedList<>();
|
||||
list.add(new NoRollbackRuleAttribute("Throwable"));
|
||||
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
|
||||
|
||||
@@ -154,7 +154,7 @@ public class RuleBasedTransactionAttributeTests {
|
||||
*/
|
||||
@Test
|
||||
public void testConflictingRulesToDetermineExactContract() {
|
||||
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> list = new LinkedList<>();
|
||||
list.add(new NoRollbackRuleAttribute(MyBusinessWarningException.class));
|
||||
list.add(new RollbackRuleAttribute(MyBusinessException.class));
|
||||
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -42,9 +42,9 @@ public class MockUOWManager implements UOWManager {
|
||||
|
||||
private int status = UOW_STATUS_NONE;
|
||||
|
||||
private final Map<Object, Object> resources = new HashMap<Object, Object>();
|
||||
private final Map<Object, Object> resources = new HashMap<>();
|
||||
|
||||
private final List<Synchronization> synchronizations = new LinkedList<Synchronization>();
|
||||
private final List<Synchronization> synchronizations = new LinkedList<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -148,7 +148,7 @@ public class SimpleTransactionScopeTests {
|
||||
|
||||
CallCountingTransactionManager tm = new CallCountingTransactionManager();
|
||||
TransactionTemplate tt = new TransactionTemplate(tm);
|
||||
Set<DerivedTestBean> finallyDestroy = new HashSet<DerivedTestBean>();
|
||||
Set<DerivedTestBean> finallyDestroy = new HashSet<>();
|
||||
|
||||
tt.execute(status -> {
|
||||
TestBean bean1 = context.getBean(TestBean.class);
|
||||
@@ -173,7 +173,7 @@ public class SimpleTransactionScopeTests {
|
||||
assertNotSame(bean2, bean2b);
|
||||
assertNotSame(bean2a, bean2b);
|
||||
|
||||
Set<DerivedTestBean> immediatelyDestroy = new HashSet<DerivedTestBean>();
|
||||
Set<DerivedTestBean> immediatelyDestroy = new HashSet<>();
|
||||
TransactionTemplate tt2 = new TransactionTemplate(tm);
|
||||
tt2.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);
|
||||
tt2.execute(status2 -> {
|
||||
|
||||
Reference in New Issue
Block a user