Explicit type can be replaced by <>

Issue: SPR-13188
This commit is contained in:
Stephane Nicoll
2016-07-05 17:00:26 +02:00
parent 3096888c7d
commit 00d2606b00
1044 changed files with 3972 additions and 3893 deletions

View File

@@ -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.
@@ -174,7 +174,7 @@ public class ConstructorInvocationTests extends AbstractExpressionTests {
ctx.addConstructorResolver(dummy);
assertEquals(2, ctx.getConstructorResolvers().size());
List<ConstructorResolver> copy = new ArrayList<ConstructorResolver>();
List<ConstructorResolver> copy = new ArrayList<>();
copy.addAll(ctx.getConstructorResolvers());
assertTrue(ctx.removeConstructorResolver(dummy));
assertFalse(ctx.removeConstructorResolver(dummy));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -625,7 +625,7 @@ public class EvaluationTests extends AbstractExpressionTests {
StandardEvaluationContext context = new StandardEvaluationContext();
// Register a custom MethodResolver...
List<MethodResolver> customResolvers = new ArrayList<MethodResolver>();
List<MethodResolver> customResolvers = new ArrayList<>();
customResolvers.add(new CustomMethodResolver());
context.setMethodResolvers(customResolvers);
@@ -694,7 +694,7 @@ public class EvaluationTests extends AbstractExpressionTests {
integerArray[2] = 3;
integerArray[3] = 4;
integerArray[4] = 5;
listOfStrings = new ArrayList<String>();
listOfStrings = new ArrayList<>();
listOfStrings.add("abc");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -100,7 +100,7 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
// Use the standard evaluation context
StandardEvaluationContext ctx = new StandardEvaluationContext();
ctx.setVariable("favouriteColour","blue");
List<Integer> primes = new ArrayList<Integer>();
List<Integer> primes = new ArrayList<>();
primes.addAll(Arrays.asList(2,3,5,7,11,13,17));
ctx.setVariable("primes",primes);
@@ -251,7 +251,7 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
*/
private static class FruitColourAccessor implements PropertyAccessor {
private static Map<String,Color> propertyMap = new HashMap<String,Color>();
private static Map<String,Color> propertyMap = new HashMap<>();
static {
propertyMap.put("banana",Color.yellow);
@@ -296,7 +296,7 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
*/
private static class VegetableColourAccessor implements PropertyAccessor {
private static Map<String,Color> propertyMap = new HashMap<String,Color>();
private static Map<String,Color> propertyMap = new HashMap<>();
static {
propertyMap.put("carrot",Color.orange);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -197,7 +197,7 @@ public class ExpressionStateTests extends AbstractExpressionTests {
assertNull(state.lookupLocalVariable("foo"));
assertNull(state.lookupLocalVariable("goo"));
Map<String,Object> m = new HashMap<String,Object>();
Map<String,Object> m = new HashMap<>();
m.put("foo",34);
m.put("goo","abc");

View File

@@ -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.
@@ -44,9 +44,9 @@ import static org.junit.Assert.*;
*/
public class ExpressionWithConversionTests extends AbstractExpressionTests {
private static List<String> listOfString = new ArrayList<String>();
private static List<String> listOfString = new ArrayList<>();
private static TypeDescriptor typeDescriptorForListOfString = null;
private static List<Integer> listOfInteger = new ArrayList<Integer>();
private static List<Integer> listOfInteger = new ArrayList<>();
private static TypeDescriptor typeDescriptorForListOfInteger = null;
static {

View File

@@ -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.
@@ -44,7 +44,7 @@ public class IndexingTests {
@Test
public void indexIntoGenericPropertyContainingMap() {
Map<String, String> property = new HashMap<String, String>();
Map<String, String> property = new HashMap<>();
property.put("foo", "bar");
this.property = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -61,8 +61,8 @@ public class IndexingTests {
@Test
public void indexIntoGenericPropertyContainingMapObject() {
Map<String, Map<String, String>> property = new HashMap<String, Map<String, String>>();
Map<String, String> map = new HashMap<String, String>();
Map<String, Map<String, String>> property = new HashMap<>();
Map<String, String> map = new HashMap<>();
map.put("foo", "bar");
property.put("property", map);
SpelExpressionParser parser = new SpelExpressionParser();
@@ -110,7 +110,7 @@ public class IndexingTests {
@Test
public void setGenericPropertyContainingMap() {
Map<String, String> property = new HashMap<String, String>();
Map<String, String> property = new HashMap<>();
property.put("foo", "bar");
this.property = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -125,7 +125,7 @@ public class IndexingTests {
@Test
public void setPropertyContainingMap() {
Map<Integer, Integer> property = new HashMap<Integer, Integer>();
Map<Integer, Integer> property = new HashMap<>();
property.put(9, 3);
this.parameterizedMap = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -154,7 +154,7 @@ public class IndexingTests {
@Test
public void indexIntoGenericPropertyContainingList() {
List<String> property = new ArrayList<String>();
List<String> property = new ArrayList<>();
property.add("bar");
this.property = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -167,7 +167,7 @@ public class IndexingTests {
@Test
public void setGenericPropertyContainingList() {
List<Integer> property = new ArrayList<Integer>();
List<Integer> property = new ArrayList<>();
property.add(3);
this.property = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -182,7 +182,7 @@ public class IndexingTests {
@Test
public void setGenericPropertyContainingListAutogrow() {
List<Integer> property = new ArrayList<Integer>();
List<Integer> property = new ArrayList<>();
this.property = property;
SpelExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
Expression expression = parser.parseExpression("property");
@@ -199,7 +199,7 @@ public class IndexingTests {
@Test
public void indexIntoPropertyContainingList() {
List<Integer> property = new ArrayList<Integer>();
List<Integer> property = new ArrayList<>();
property.add(3);
this.parameterizedList = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -214,7 +214,7 @@ public class IndexingTests {
@Test
public void indexIntoPropertyContainingListOfList() {
List<List<Integer>> property = new ArrayList<List<Integer>>();
List<List<Integer>> property = new ArrayList<>();
property.add(Arrays.asList(3));
this.parameterizedListOfList = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -229,7 +229,7 @@ public class IndexingTests {
@Test
public void setPropertyContainingList() {
List<Integer> property = new ArrayList<Integer>();
List<Integer> property = new ArrayList<>();
property.add(3);
this.parameterizedList = property;
SpelExpressionParser parser = new SpelExpressionParser();
@@ -260,7 +260,7 @@ public class IndexingTests {
@Test
public void indexIntoGenericPropertyContainingGrowingList() {
List<String> property = new ArrayList<String>();
List<String> property = new ArrayList<>();
this.property = property;
SpelParserConfiguration configuration = new SpelParserConfiguration(true, true);
SpelExpressionParser parser = new SpelExpressionParser(configuration);
@@ -278,7 +278,7 @@ public class IndexingTests {
@Test
public void indexIntoGenericPropertyContainingGrowingList2() {
List<String> property2 = new ArrayList<String>();
List<String> property2 = new ArrayList<>();
this.property2 = property2;
SpelParserConfiguration configuration = new SpelParserConfiguration(true, true);
SpelExpressionParser parser = new SpelExpressionParser(configuration);

View File

@@ -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.
@@ -38,7 +38,7 @@ public class ListTests extends AbstractExpressionTests {
// if the list is full of literals then it will be of the type unmodifiableClass
// rather than ArrayList
Class<?> unmodifiableClass = Collections.unmodifiableList(new ArrayList<Object>()).getClass();
Class<?> unmodifiableClass = Collections.unmodifiableList(new ArrayList<>()).getClass();
@Test

View File

@@ -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.
@@ -77,7 +77,7 @@ public class MapAccessTests extends AbstractExpressionTests {
@Test
public void testGetValue(){
Map<String,String> props1 = new HashMap<String,String>();
Map<String,String> props1 = new HashMap<>();
props1.put("key1", "value1");
props1.put("key2", "value2");
props1.put("key3", "value3");
@@ -91,7 +91,7 @@ public class MapAccessTests extends AbstractExpressionTests {
@Test
public void testGetValueFromRootMap() {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("key", "value");
ExpressionParser spelExpressionParser = new SpelExpressionParser();
@@ -102,7 +102,7 @@ public class MapAccessTests extends AbstractExpressionTests {
@Test
public void testGetValuePerformance() throws Exception {
Assume.group(TestGroup.PERFORMANCE);
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("key", "value");
EvaluationContext context = new StandardEvaluationContext(map);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-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.
@@ -39,7 +39,7 @@ public class MapTests extends AbstractExpressionTests {
// if the list is full of literals then it will be of the type unmodifiableClass
// rather than HashMap (or similar)
Class<?> unmodifiableClass = Collections.unmodifiableMap(new LinkedHashMap<Object,Object>()).getClass();
Class<?> unmodifiableClass = Collections.unmodifiableMap(new LinkedHashMap<>()).getClass();
@Test

View File

@@ -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.
@@ -251,7 +251,7 @@ public class MethodInvocationTests extends AbstractExpressionTests {
ctx.addMethodResolver(dummy);
assertEquals(2, ctx.getMethodResolvers().size());
List<MethodResolver> copy = new ArrayList<MethodResolver>();
List<MethodResolver> copy = new ArrayList<>();
copy.addAll(ctx.getMethodResolvers());
assertTrue(ctx.removeMethodResolver(dummy));
assertFalse(ctx.removeMethodResolver(dummy));
@@ -341,7 +341,7 @@ public class MethodInvocationTests extends AbstractExpressionTests {
@Override
public List<Method> filter(List<Method> methods) {
filterCalled = true;
List<Method> forRemoval = new ArrayList<Method>();
List<Method> forRemoval = new ArrayList<>();
for (Method method: methods) {
if (removeIfNotAnnotated && !isAnnotated(method)) {
forRemoval.add(method);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -150,7 +150,7 @@ public class PropertyAccessTests extends AbstractExpressionTests {
ctx.addPropertyAccessor(spa);
assertEquals(2,ctx.getPropertyAccessors().size());
List<PropertyAccessor> copy = new ArrayList<PropertyAccessor>();
List<PropertyAccessor> copy = new ArrayList<>();
copy.addAll(ctx.getPropertyAccessors());
assertTrue(ctx.removePropertyAccessor(spa));
assertFalse(ctx.removePropertyAccessor(spa));

View File

@@ -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.
@@ -292,7 +292,7 @@ public class SelectionAndProjectionTests {
static class ListTestBean {
private final List<Integer> integers = new ArrayList<Integer>();
private final List<Integer> integers = new ArrayList<>();
ListTestBean() {
for (int i = 0; i < 10; i++) {
@@ -308,7 +308,7 @@ public class SelectionAndProjectionTests {
static class SetTestBean {
private final Set<Integer> integers = new LinkedHashSet<Integer>();
private final Set<Integer> integers = new LinkedHashSet<>();
SetTestBean() {
for (int i = 0; i < 10; i++) {
@@ -324,7 +324,7 @@ public class SelectionAndProjectionTests {
static class IterableTestBean {
private final Set<Integer> integers = new LinkedHashSet<Integer>();
private final Set<Integer> integers = new LinkedHashSet<>();
IterableTestBean() {
for (int i = 0; i < 10; i++) {
@@ -368,7 +368,7 @@ public class SelectionAndProjectionTests {
static class MapTestBean {
private final Map<String, String> colors = new TreeMap<String, String>();
private final Map<String, String> colors = new TreeMap<>();
MapTestBean() {
// colors.put("black", "schwarz");
@@ -398,7 +398,7 @@ public class SelectionAndProjectionTests {
}
static List<IntegerTestBean> createList() {
List<IntegerTestBean> list = new ArrayList<IntegerTestBean>();
List<IntegerTestBean> list = new ArrayList<>();
for (int i = 0; i < 3; i++) {
list.add(new IntegerTestBean(i + 5));
}
@@ -406,7 +406,7 @@ public class SelectionAndProjectionTests {
}
static Set<IntegerTestBean> createSet() {
Set<IntegerTestBean> set = new LinkedHashSet<IntegerTestBean>();
Set<IntegerTestBean> set = new LinkedHashSet<>();
for (int i = 0; i < 3; i++) {
set.add(new IntegerTestBean(i + 5));
}

View File

@@ -198,7 +198,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertCanCompile(expression);
assertEquals(false,expression.getValue());
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
expression = parse("#root instanceof T(java.util.List)");
assertEquals(true,expression.getValue(list));
assertCanCompile(expression);
@@ -2923,11 +2923,11 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals(0,expression.getValue());
expression = parse("payload%2==0");
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(5),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(5),Boolean.TYPE));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(5),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(5),Boolean.TYPE));
expression = parse("8%3");
assertEquals(2,expression.getValue());
@@ -3897,7 +3897,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@Test
public void mixingItUp_indexerOpEqTernary() throws Exception {
Map<String, String> m = new HashMap<String,String>();
Map<String, String> m = new HashMap<>();
m.put("andy","778");
expression = parse("['andy']==null?1:2");
@@ -4028,7 +4028,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("C",getAst().getExitDescriptor());
// Collections
List<String> strings = new ArrayList<String>();
List<String> strings = new ArrayList<>();
strings.add("aaa");
strings.add("bbb");
strings.add("ccc");
@@ -4038,7 +4038,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("bbb",expression.getValue(strings));
assertEquals("Ljava/lang/Object",getAst().getExitDescriptor());
List<Integer> ints = new ArrayList<Integer>();
List<Integer> ints = new ArrayList<>();
ints.add(123);
ints.add(456);
ints.add(789);
@@ -4049,7 +4049,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("Ljava/lang/Object",getAst().getExitDescriptor());
// Maps
Map<String,Integer> map1 = new HashMap<String,Integer>();
Map<String,Integer> map1 = new HashMap<>();
map1.put("aaa", 111);
map1.put("bbb", 222);
map1.put("ccc", 333);
@@ -4082,7 +4082,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
// list of arrays
List<String[]> listOfStringArrays = new ArrayList<String[]>();
List<String[]> listOfStringArrays = new ArrayList<>();
listOfStringArrays.add(new String[]{"a","b","c"});
listOfStringArrays.add(new String[]{"d","e","f"});
expression = parser.parseExpression("[1]");
@@ -4097,7 +4097,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("d",stringify(expression.getValue(listOfStringArrays)));
assertEquals("Ljava/lang/String",getAst().getExitDescriptor());
List<Integer[]> listOfIntegerArrays = new ArrayList<Integer[]>();
List<Integer[]> listOfIntegerArrays = new ArrayList<>();
listOfIntegerArrays.add(new Integer[]{1,2,3});
listOfIntegerArrays.add(new Integer[]{4,5,6});
expression = parser.parseExpression("[0]");
@@ -4114,11 +4114,11 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
// array of lists
List<String>[] stringArrayOfLists = new ArrayList[2];
stringArrayOfLists[0] = new ArrayList<String>();
stringArrayOfLists[0] = new ArrayList<>();
stringArrayOfLists[0].add("a");
stringArrayOfLists[0].add("b");
stringArrayOfLists[0].add("c");
stringArrayOfLists[1] = new ArrayList<String>();
stringArrayOfLists[1] = new ArrayList<>();
stringArrayOfLists[1].add("d");
stringArrayOfLists[1].add("e");
stringArrayOfLists[1].add("f");
@@ -4163,13 +4163,13 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("I",getAst().getExitDescriptor());
// list of lists of reference types
List<List<String>> listOfListOfStrings = new ArrayList<List<String>>();
List<String> list = new ArrayList<String>();
List<List<String>> listOfListOfStrings = new ArrayList<>();
List<String> list = new ArrayList<>();
list.add("a");
list.add("b");
list.add("c");
listOfListOfStrings.add(list);
list = new ArrayList<String>();
list = new ArrayList<>();
list.add("d");
list.add("e");
list.add("f");
@@ -4189,8 +4189,8 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("Ljava/lang/Object",getAst().getExitDescriptor());
// Map of lists
Map<String,List<String>> mapToLists = new HashMap<String,List<String>>();
list = new ArrayList<String>();
Map<String,List<String>> mapToLists = new HashMap<>();
list = new ArrayList<>();
list.add("a");
list.add("b");
list.add("c");
@@ -4209,7 +4209,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertEquals("Ljava/lang/Object",getAst().getExitDescriptor());
// Map to array
Map<String,int[]> mapToIntArray = new HashMap<String,int[]>();
Map<String,int[]> mapToIntArray = new HashMap<>();
StandardEvaluationContext ctx = new StandardEvaluationContext();
ctx.addPropertyAccessor(new CompilableMapAccessor());
mapToIntArray.put("foo",new int[]{1,2,3});
@@ -4244,7 +4244,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
// Map array
Map<String,String>[] mapArray = new Map[1];
mapArray[0] = new HashMap<String,String>();
mapArray[0] = new HashMap<>();
mapArray[0].put("key", "value1");
expression = parser.parseExpression("[0]");
assertEquals("{key=value1}",stringify(expression.getValue(mapArray)));
@@ -4334,197 +4334,197 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@Test
public void compilerWithGenerics_12040() {
expression = parser.parseExpression("payload!=2");
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.class));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(2),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(2),Boolean.class));
expression = parser.parseExpression("2!=payload");
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.class));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(2),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(2),Boolean.class));
expression = parser.parseExpression("payload!=6L");
assertTrue(expression.getValue(new GenericMessageTestHelper<Long>(4L),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(4L),Boolean.class));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper<Long>(6L),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(6L),Boolean.class));
expression = parser.parseExpression("payload==2");
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.class));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(2),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(2),Boolean.class));
expression = parser.parseExpression("2==payload");
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.class));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(2),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(2),Boolean.class));
expression = parser.parseExpression("payload==6L");
assertFalse(expression.getValue(new GenericMessageTestHelper<Long>(4L),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(4L),Boolean.class));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper<Long>(6L),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(6L),Boolean.class));
expression = parser.parseExpression("2==payload");
assertFalse(expression.getValue(new GenericMessageTestHelper<Integer>(4),Boolean.class));
assertFalse(expression.getValue(new GenericMessageTestHelper<>(4),Boolean.class));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper<Integer>(2),Boolean.class));
assertTrue(expression.getValue(new GenericMessageTestHelper<>(2),Boolean.class));
expression = parser.parseExpression("payload/2");
assertEquals(2,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(2,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(3,expression.getValue(new GenericMessageTestHelper<Integer>(6)));
assertEquals(3,expression.getValue(new GenericMessageTestHelper<>(6)));
expression = parser.parseExpression("100/payload");
assertEquals(25,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(25,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(10,expression.getValue(new GenericMessageTestHelper<Integer>(10)));
assertEquals(10,expression.getValue(new GenericMessageTestHelper<>(10)));
expression = parser.parseExpression("payload+2");
assertEquals(6,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(6,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(8,expression.getValue(new GenericMessageTestHelper<Integer>(6)));
assertEquals(8,expression.getValue(new GenericMessageTestHelper<>(6)));
expression = parser.parseExpression("100+payload");
assertEquals(104,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(104,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(110,expression.getValue(new GenericMessageTestHelper<Integer>(10)));
assertEquals(110,expression.getValue(new GenericMessageTestHelper<>(10)));
expression = parser.parseExpression("payload-2");
assertEquals(2,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(2,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(4,expression.getValue(new GenericMessageTestHelper<Integer>(6)));
assertEquals(4,expression.getValue(new GenericMessageTestHelper<>(6)));
expression = parser.parseExpression("100-payload");
assertEquals(96,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(96,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(90,expression.getValue(new GenericMessageTestHelper<Integer>(10)));
assertEquals(90,expression.getValue(new GenericMessageTestHelper<>(10)));
expression = parser.parseExpression("payload*2");
assertEquals(8,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(8,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(12,expression.getValue(new GenericMessageTestHelper<Integer>(6)));
assertEquals(12,expression.getValue(new GenericMessageTestHelper<>(6)));
expression = parser.parseExpression("100*payload");
assertEquals(400,expression.getValue(new GenericMessageTestHelper<Integer>(4)));
assertEquals(400,expression.getValue(new GenericMessageTestHelper<>(4)));
assertCanCompile(expression);
assertEquals(1000,expression.getValue(new GenericMessageTestHelper<Integer>(10)));
assertEquals(1000,expression.getValue(new GenericMessageTestHelper<>(10)));
expression = parser.parseExpression("payload/2L");
assertEquals(2L,expression.getValue(new GenericMessageTestHelper<Long>(4L)));
assertEquals(2L,expression.getValue(new GenericMessageTestHelper<>(4L)));
assertCanCompile(expression);
assertEquals(3L,expression.getValue(new GenericMessageTestHelper<Long>(6L)));
assertEquals(3L,expression.getValue(new GenericMessageTestHelper<>(6L)));
expression = parser.parseExpression("100L/payload");
assertEquals(25L,expression.getValue(new GenericMessageTestHelper<Long>(4L)));
assertEquals(25L,expression.getValue(new GenericMessageTestHelper<>(4L)));
assertCanCompile(expression);
assertEquals(10L,expression.getValue(new GenericMessageTestHelper<Long>(10L)));
assertEquals(10L,expression.getValue(new GenericMessageTestHelper<>(10L)));
expression = parser.parseExpression("payload/2f");
assertEquals(2f,expression.getValue(new GenericMessageTestHelper<Float>(4f)));
assertEquals(2f,expression.getValue(new GenericMessageTestHelper<>(4f)));
assertCanCompile(expression);
assertEquals(3f,expression.getValue(new GenericMessageTestHelper<Float>(6f)));
assertEquals(3f,expression.getValue(new GenericMessageTestHelper<>(6f)));
expression = parser.parseExpression("100f/payload");
assertEquals(25f,expression.getValue(new GenericMessageTestHelper<Float>(4f)));
assertEquals(25f,expression.getValue(new GenericMessageTestHelper<>(4f)));
assertCanCompile(expression);
assertEquals(10f,expression.getValue(new GenericMessageTestHelper<Float>(10f)));
assertEquals(10f,expression.getValue(new GenericMessageTestHelper<>(10f)));
expression = parser.parseExpression("payload/2d");
assertEquals(2d,expression.getValue(new GenericMessageTestHelper<Double>(4d)));
assertEquals(2d,expression.getValue(new GenericMessageTestHelper<>(4d)));
assertCanCompile(expression);
assertEquals(3d,expression.getValue(new GenericMessageTestHelper<Double>(6d)));
assertEquals(3d,expression.getValue(new GenericMessageTestHelper<>(6d)));
expression = parser.parseExpression("100d/payload");
assertEquals(25d,expression.getValue(new GenericMessageTestHelper<Double>(4d)));
assertEquals(25d,expression.getValue(new GenericMessageTestHelper<>(4d)));
assertCanCompile(expression);
assertEquals(10d,expression.getValue(new GenericMessageTestHelper<Double>(10d)));
assertEquals(10d,expression.getValue(new GenericMessageTestHelper<>(10d)));
}
// The new helper class here uses an upper bound on the generic
@Test
public void compilerWithGenerics_12040_2() {
expression = parser.parseExpression("payload/2");
assertEquals(2,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(2,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(3,expression.getValue(new GenericMessageTestHelper2<Integer>(6)));
assertEquals(3,expression.getValue(new GenericMessageTestHelper2<>(6)));
expression = parser.parseExpression("9/payload");
assertEquals(1,expression.getValue(new GenericMessageTestHelper2<Integer>(9)));
assertEquals(1,expression.getValue(new GenericMessageTestHelper2<>(9)));
assertCanCompile(expression);
assertEquals(3,expression.getValue(new GenericMessageTestHelper2<Integer>(3)));
assertEquals(3,expression.getValue(new GenericMessageTestHelper2<>(3)));
expression = parser.parseExpression("payload+2");
assertEquals(6,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(6,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(8,expression.getValue(new GenericMessageTestHelper2<Integer>(6)));
assertEquals(8,expression.getValue(new GenericMessageTestHelper2<>(6)));
expression = parser.parseExpression("100+payload");
assertEquals(104,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(104,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(110,expression.getValue(new GenericMessageTestHelper2<Integer>(10)));
assertEquals(110,expression.getValue(new GenericMessageTestHelper2<>(10)));
expression = parser.parseExpression("payload-2");
assertEquals(2,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(2,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(4,expression.getValue(new GenericMessageTestHelper2<Integer>(6)));
assertEquals(4,expression.getValue(new GenericMessageTestHelper2<>(6)));
expression = parser.parseExpression("100-payload");
assertEquals(96,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(96,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(90,expression.getValue(new GenericMessageTestHelper2<Integer>(10)));
assertEquals(90,expression.getValue(new GenericMessageTestHelper2<>(10)));
expression = parser.parseExpression("payload*2");
assertEquals(8,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(8,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(12,expression.getValue(new GenericMessageTestHelper2<Integer>(6)));
assertEquals(12,expression.getValue(new GenericMessageTestHelper2<>(6)));
expression = parser.parseExpression("100*payload");
assertEquals(400,expression.getValue(new GenericMessageTestHelper2<Integer>(4)));
assertEquals(400,expression.getValue(new GenericMessageTestHelper2<>(4)));
assertCanCompile(expression);
assertEquals(1000,expression.getValue(new GenericMessageTestHelper2<Integer>(10)));
assertEquals(1000,expression.getValue(new GenericMessageTestHelper2<>(10)));
}
// The other numeric operators
@Test
public void compilerWithGenerics_12040_3() {
expression = parser.parseExpression("payload >= 2");
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(4),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(4),Boolean.TYPE));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
expression = parser.parseExpression("2 >= payload");
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(5),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(5),Boolean.TYPE));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
expression = parser.parseExpression("payload > 2");
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(4),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(4),Boolean.TYPE));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
expression = parser.parseExpression("2 > payload");
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(5),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(5),Boolean.TYPE));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
expression = parser.parseExpression("payload <=2");
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(6),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(6),Boolean.TYPE));
expression = parser.parseExpression("2 <= payload");
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(6),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(6),Boolean.TYPE));
expression = parser.parseExpression("payload < 2");
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
assertCanCompile(expression);
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(6),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(6),Boolean.TYPE));
expression = parser.parseExpression("2 < payload");
assertFalse(expression.getValue(new GenericMessageTestHelper2<Integer>(1),Boolean.TYPE));
assertFalse(expression.getValue(new GenericMessageTestHelper2<>(1),Boolean.TYPE));
assertCanCompile(expression);
assertTrue(expression.getValue(new GenericMessageTestHelper2<Integer>(6),Boolean.TYPE));
assertTrue(expression.getValue(new GenericMessageTestHelper2<>(6),Boolean.TYPE));
}
@Test

View File

@@ -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.
@@ -70,9 +70,9 @@ public class SpelDocumentationTests extends AbstractExpressionTests {
public Inventor[] Members = new Inventor[1];
public List Members2 = new ArrayList();
public Map<String,Object> officers = new HashMap<String,Object>();
public Map<String,Object> officers = new HashMap<>();
public List<Map<String, Object>> reverse = new ArrayList<Map<String, Object>>();
public List<Map<String, Object>> reverse = new ArrayList<>();
@SuppressWarnings("unchecked")
IEEE() {
@@ -419,7 +419,7 @@ public class SpelDocumentationTests extends AbstractExpressionTests {
@Test
public void testSpecialVariables() throws Exception {
// create an array of integers
List<Integer> primes = new ArrayList<Integer>();
List<Integer> primes = new ArrayList<>();
primes.addAll(Arrays.asList(2,3,5,7,11,13,17));
// create parser and set variable 'primes' as the array of integers

View File

@@ -228,7 +228,7 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
public void SPR5804() throws Exception {
Map<String, String> m = new HashMap<String, String>();
Map<String, String> m = new HashMap<>();
m.put("foo", "bar");
StandardEvaluationContext eContext = new StandardEvaluationContext(m); // root is a map instance
eContext.addPropertyAccessor(new MapAccessor());
@@ -550,7 +550,7 @@ public class SpelReproTests extends AbstractExpressionTests {
public String floo = "bar";
public XX() {
m = new HashMap<String, String>();
m = new HashMap<>();
m.put("$foo", "wibble");
m.put("bar", "siddle");
}
@@ -579,7 +579,7 @@ public class SpelReproTests extends AbstractExpressionTests {
static class Holder {
public Map<String, String> map = new HashMap<String, String>();
public Map<String, String> map = new HashMap<>();
}
@@ -783,9 +783,9 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
public void mapOfMap_SPR7244() throws Exception {
Map<String, Object> map = new LinkedHashMap<String, Object>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("uri", "http:");
Map<String, String> nameMap = new LinkedHashMap<String, String>();
Map<String, String> nameMap = new LinkedHashMap<>();
nameMap.put("givenName", "Arthur");
map.put("value", nameMap);
@@ -849,11 +849,11 @@ public class SpelReproTests extends AbstractExpressionTests {
public Map<String, String> ms;
C() {
ls = new ArrayList<String>();
ls = new ArrayList<>();
ls.add("abc");
ls.add("def");
as = new String[] { "abc", "def" };
ms = new HashMap<String, String>();
ms = new HashMap<>();
ms.put("abc", "xyz");
ms.put("def", "pqr");
}
@@ -877,7 +877,7 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
public void greaterThanWithNulls_SPR7840() throws Exception {
List<D> list = new ArrayList<D>();
List<D> list = new ArrayList<>();
list.add(new D("aaa"));
list.add(new D("bbb"));
list.add(new D(null));
@@ -937,7 +937,7 @@ public class SpelReproTests extends AbstractExpressionTests {
EvaluationContext emptyEvalContext = new StandardEvaluationContext();
List<TypeDescriptor> args = new ArrayList<TypeDescriptor>();
List<TypeDescriptor> args = new ArrayList<>();
args.add(TypeDescriptor.forObject(new Integer(42)));
ConversionPriority1 target = new ConversionPriority1();
@@ -977,7 +977,7 @@ public class SpelReproTests extends AbstractExpressionTests {
WideningPrimitiveConversion target = new WideningPrimitiveConversion();
EvaluationContext emptyEvalContext = new StandardEvaluationContext();
List<TypeDescriptor> args = new ArrayList<TypeDescriptor>();
List<TypeDescriptor> args = new ArrayList<>();
args.add(TypeDescriptor.forObject(INTEGER_VALUE));
MethodExecutor me = new ReflectiveMethodResolver(true).resolve(emptyEvalContext, target, "getX", args);
@@ -990,10 +990,10 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
public void varargsAndPrimitives_SPR8174() throws Exception {
EvaluationContext emptyEvalContext = new StandardEvaluationContext();
List<TypeDescriptor> args = new ArrayList<TypeDescriptor>();
List<TypeDescriptor> args = new ArrayList<>();
args.add(TypeDescriptor.forObject(34L));
ReflectionUtil<Integer> ru = new ReflectionUtil<Integer>();
ReflectionUtil<Integer> ru = new ReflectionUtil<>();
MethodExecutor me = new ReflectiveMethodResolver().resolve(emptyEvalContext, ru, "methodToCall", args);
args.set(0, TypeDescriptor.forObject(23));
@@ -1113,7 +1113,7 @@ public class SpelReproTests extends AbstractExpressionTests {
public int DIV = 1;
public int div = 3;
public Map<String, String> m = new HashMap<String, String>();
public Map<String, String> m = new HashMap<>();
Reserver() {
m.put("NE", "xyz");
@@ -1229,10 +1229,10 @@ public class SpelReproTests extends AbstractExpressionTests {
class ContextObject {
public Map<String, String> firstContext = new HashMap<String, String>();
public Map<String, String> secondContext = new HashMap<String, String>();
public Map<String, String> thirdContext = new HashMap<String, String>();
public Map<String, String> fourthContext = new HashMap<String, String>();
public Map<String, String> firstContext = new HashMap<>();
public Map<String, String> secondContext = new HashMap<>();
public Map<String, String> thirdContext = new HashMap<>();
public Map<String, String> fourthContext = new HashMap<>();
public ContextObject() {
firstContext.put("shouldBeFirst", "first");
@@ -1276,7 +1276,7 @@ public class SpelReproTests extends AbstractExpressionTests {
public void customStaticFunctions_SPR9038() {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext();
List<MethodResolver> methodResolvers = new ArrayList<MethodResolver>();
List<MethodResolver> methodResolvers = new ArrayList<>();
methodResolvers.add(new ReflectiveMethodResolver() {
@Override
protected Method[] getMethods(Class<?> type) {
@@ -1802,7 +1802,7 @@ public class SpelReproTests extends AbstractExpressionTests {
public void SPR9194() {
TestClass2 one = new TestClass2("abc");
TestClass2 two = new TestClass2("abc");
Map<String, TestClass2> map = new HashMap<String, TestClass2>();
Map<String, TestClass2> map = new HashMap<>();
map.put("one", one);
map.put("two", two);
@@ -1813,7 +1813,7 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
public void SPR11348() {
Collection<String> coll = new LinkedHashSet<String>();
Collection<String> coll = new LinkedHashSet<>();
coll.add("one");
coll.add("two");
coll = Collections.unmodifiableCollection(coll);
@@ -1927,10 +1927,10 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
@SuppressWarnings("rawtypes")
public void SPR13055() throws Exception {
List<Map<String, Object>> myPayload = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> myPayload = new ArrayList<>();
Map<String, Object> v1 = new HashMap<String, Object>();
Map<String, Object> v2 = new HashMap<String, Object>();
Map<String, Object> v1 = new HashMap<>();
Map<String, Object> v2 = new HashMap<>();
v1.put("test11", "test11");
v1.put("test12", "test12");
@@ -2269,7 +2269,7 @@ public class SpelReproTests extends AbstractExpressionTests {
private String name;
private List<Item> children = new ArrayList<Item>();
private List<Item> children = new ArrayList<>();
public void setName(String name) {
this.name = name;
@@ -2411,7 +2411,7 @@ public class SpelReproTests extends AbstractExpressionTests {
public static class GuavaLists {
public static <T> List<T> newArrayList(Iterable<T> iterable) {
return new ArrayList<T>();
return new ArrayList<>();
}
public static <T> List<T> newArrayList(Object... elements) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 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.
@@ -50,7 +50,7 @@ public class PropertiesConversionSpelTests {
@Test
public void mapWithAllStringValues() {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("x", "1");
map.put("y", "2");
map.put("z", "3");
@@ -63,7 +63,7 @@ public class PropertiesConversionSpelTests {
@Test
public void mapWithNonStringValue() {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("x", "1");
map.put("y", 2);
map.put("z", "3");

View File

@@ -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.
@@ -535,7 +535,7 @@ public class ReflectionHelperTests extends AbstractExpressionTests {
}
private List<TypeDescriptor> getTypeDescriptors(Class<?>... types) {
List<TypeDescriptor> typeDescriptors = new ArrayList<TypeDescriptor>(types.length);
List<TypeDescriptor> typeDescriptors = new ArrayList<>(types.length);
for (Class<?> type : types) {
typeDescriptors.add(TypeDescriptor.valueOf(type));
}

View File

@@ -1,3 +1,19 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.expression.spel.testresources;
import java.util.ArrayList;
@@ -25,16 +41,16 @@ public class Inventor {
public Map<String,String> testMap;
private boolean wonNobelPrize;
private PlaceOfBirth[] placesLived;
private List<PlaceOfBirth> placesLivedList = new ArrayList<PlaceOfBirth>();
private List<PlaceOfBirth> placesLivedList = new ArrayList<>();
public ArrayContainer arrayContainer;
public boolean publicBoolean;
private boolean accessedThroughGetSet;
public List<Integer> listOfInteger = new ArrayList<Integer>();
public List<Boolean> booleanList = new ArrayList<Boolean>();
public Map<String,Boolean> mapOfStringToBoolean = new LinkedHashMap<String,Boolean>();
public Map<Integer,String> mapOfNumbersUpToTen = new LinkedHashMap<Integer,String>();
public List<Integer> listOfNumbersUpToTen = new ArrayList<Integer>();
public List<Integer> listOneFive = new ArrayList<Integer>();
public List<Integer> listOfInteger = new ArrayList<>();
public List<Boolean> booleanList = new ArrayList<>();
public Map<String,Boolean> mapOfStringToBoolean = new LinkedHashMap<>();
public Map<Integer,String> mapOfNumbersUpToTen = new LinkedHashMap<>();
public List<Integer> listOfNumbersUpToTen = new ArrayList<>();
public List<Integer> listOneFive = new ArrayList<>();
public String[] stringArrayOfThreeItems = new String[]{"1","2","3"};
private String foo;
public int counter;
@@ -46,7 +62,7 @@ public class Inventor {
this.birthdate = birthdate;
this.nationality = nationality;
this.arrayContainer = new ArrayContainer();
testMap = new HashMap<String,String>();
testMap = new HashMap<>();
testMap.put("monday", "montag");
testMap.put("tuesday", "dienstag");
testMap.put("wednesday", "mittwoch");
@@ -164,7 +180,7 @@ public class Inventor {
}
public List<String> getDoublesAsStringList() {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
result.add("14.35");
result.add("15.45");
return result;