Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -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.
|
||||
@@ -111,7 +111,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
|
||||
*/
|
||||
private Expression[] parseExpressions(String expressionString, ParserContext context)
|
||||
throws ParseException {
|
||||
List<Expression> expressions = new LinkedList<Expression>();
|
||||
List<Expression> expressions = new LinkedList<>();
|
||||
String prefix = context.getExpressionPrefix();
|
||||
String suffix = context.getExpressionSuffix();
|
||||
int startIdx = 0;
|
||||
@@ -210,7 +210,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
|
||||
if (nextSuffix == -1) {
|
||||
return -1; // the suffix is missing
|
||||
}
|
||||
Stack<Bracket> stack = new Stack<Bracket>();
|
||||
Stack<Bracket> stack = new Stack<>();
|
||||
while (pos < maxlen) {
|
||||
if (isSuffixHere(expressionString, pos, suffix) && stack.isEmpty()) {
|
||||
break;
|
||||
|
||||
@@ -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.
|
||||
@@ -84,8 +84,8 @@ public class CodeFlow implements Opcodes {
|
||||
private int nextFreeVariableId = 1;
|
||||
|
||||
public CodeFlow(String clazzName, ClassWriter cw) {
|
||||
this.compilationScopes = new Stack<ArrayList<String>>();
|
||||
this.compilationScopes.add(new ArrayList<String>());
|
||||
this.compilationScopes = new Stack<>();
|
||||
this.compilationScopes.add(new ArrayList<>());
|
||||
this.cw = cw;
|
||||
this.clazzName = clazzName;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class CodeFlow implements Opcodes {
|
||||
* each argument will be evaluated in a new scope.
|
||||
*/
|
||||
public void enterCompilationScope() {
|
||||
this.compilationScopes.push(new ArrayList<String>());
|
||||
this.compilationScopes.push(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -809,7 +809,7 @@ public class CodeFlow implements Opcodes {
|
||||
*/
|
||||
public void registerNewField(FieldAdder fieldAdder) {
|
||||
if (fieldAdders == null) {
|
||||
fieldAdders = new ArrayList<FieldAdder>();
|
||||
fieldAdders = new ArrayList<>();
|
||||
}
|
||||
fieldAdders.add(fieldAdder);
|
||||
}
|
||||
@@ -821,7 +821,7 @@ public class CodeFlow implements Opcodes {
|
||||
*/
|
||||
public void registerNewClinit(ClinitAdder clinitAdder) {
|
||||
if (clinitAdders == null) {
|
||||
clinitAdders = new ArrayList<ClinitAdder>();
|
||||
clinitAdders = new ArrayList<>();
|
||||
}
|
||||
clinitAdders.add(clinitAdder);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -92,12 +92,12 @@ public class ExpressionState {
|
||||
|
||||
private void ensureVariableScopesInitialized() {
|
||||
if (this.variableScopes == null) {
|
||||
this.variableScopes = new Stack<VariableScope>();
|
||||
this.variableScopes = new Stack<>();
|
||||
// top level empty variable scope
|
||||
this.variableScopes.add(new VariableScope());
|
||||
}
|
||||
if (this.scopeRootObjects == null) {
|
||||
this.scopeRootObjects = new Stack<TypedValue>();
|
||||
this.scopeRootObjects = new Stack<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,14 +113,14 @@ public class ExpressionState {
|
||||
|
||||
public void pushActiveContextObject(TypedValue obj) {
|
||||
if (this.contextObjects == null) {
|
||||
this.contextObjects = new Stack<TypedValue>();
|
||||
this.contextObjects = new Stack<>();
|
||||
}
|
||||
this.contextObjects.push(obj);
|
||||
}
|
||||
|
||||
public void popActiveContextObject() {
|
||||
if (this.contextObjects == null) {
|
||||
this.contextObjects = new Stack<TypedValue>();
|
||||
this.contextObjects = new Stack<>();
|
||||
}
|
||||
this.contextObjects.pop();
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class ExpressionState {
|
||||
*/
|
||||
private static class VariableScope {
|
||||
|
||||
private final Map<String, Object> vars = new HashMap<String, Object>();
|
||||
private final Map<String, Object> vars = new HashMap<>();
|
||||
|
||||
public VariableScope() {
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -45,8 +45,8 @@ public abstract class AstUtils {
|
||||
public static List<PropertyAccessor> getPropertyAccessorsToTry(
|
||||
Class<?> targetType, List<PropertyAccessor> propertyAccessors) {
|
||||
|
||||
List<PropertyAccessor> specificAccessors = new ArrayList<PropertyAccessor>();
|
||||
List<PropertyAccessor> generalAccessors = new ArrayList<PropertyAccessor>();
|
||||
List<PropertyAccessor> specificAccessors = new ArrayList<>();
|
||||
List<PropertyAccessor> generalAccessors = new ArrayList<>();
|
||||
for (PropertyAccessor resolver : propertyAccessors) {
|
||||
Class<?>[] targets = resolver.getSpecificTargetClasses();
|
||||
if (targets == null) { // generic resolver that says it can be used for any type
|
||||
@@ -67,7 +67,7 @@ public abstract class AstUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PropertyAccessor> resolvers = new LinkedList<PropertyAccessor>();
|
||||
List<PropertyAccessor> resolvers = new LinkedList<>();
|
||||
resolvers.addAll(specificAccessors);
|
||||
resolvers.addAll(generalAccessors);
|
||||
return resolvers;
|
||||
|
||||
@@ -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.
|
||||
@@ -107,7 +107,7 @@ public class ConstructorReference extends SpelNodeImpl {
|
||||
*/
|
||||
private TypedValue createNewInstance(ExpressionState state) throws EvaluationException {
|
||||
Object[] arguments = new Object[getChildCount() - 1];
|
||||
List<TypeDescriptor> argumentTypes = new ArrayList<TypeDescriptor>(getChildCount() - 1);
|
||||
List<TypeDescriptor> argumentTypes = new ArrayList<>(getChildCount() - 1);
|
||||
for (int i = 0; i < arguments.length; i++) {
|
||||
TypedValue childValue = this.children[i + 1].getValueInternal(state);
|
||||
Object value = childValue.getValue();
|
||||
|
||||
@@ -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.
|
||||
@@ -68,7 +68,7 @@ public class InlineList extends SpelNodeImpl {
|
||||
}
|
||||
}
|
||||
if (isConstant) {
|
||||
List<Object> constantList = new ArrayList<Object>();
|
||||
List<Object> constantList = new ArrayList<>();
|
||||
int childcount = getChildCount();
|
||||
for (int c = 0; c < childcount; c++) {
|
||||
SpelNode child = getChild(c);
|
||||
@@ -89,7 +89,7 @@ public class InlineList extends SpelNodeImpl {
|
||||
return this.constant;
|
||||
}
|
||||
else {
|
||||
List<Object> returnValue = new ArrayList<Object>();
|
||||
List<Object> returnValue = new ArrayList<>();
|
||||
int childCount = getChildCount();
|
||||
for (int c = 0; c < childCount; c++) {
|
||||
returnValue.add(getChild(c).getValue(expressionState));
|
||||
|
||||
@@ -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.
|
||||
@@ -74,7 +74,7 @@ public class InlineMap extends SpelNodeImpl {
|
||||
}
|
||||
}
|
||||
if (isConstant) {
|
||||
Map<Object,Object> constantMap = new LinkedHashMap<Object,Object>();
|
||||
Map<Object,Object> constantMap = new LinkedHashMap<>();
|
||||
int childCount = getChildCount();
|
||||
for (int c = 0; c < childCount; c++) {
|
||||
SpelNode keyChild = getChild(c++);
|
||||
@@ -111,7 +111,7 @@ public class InlineMap extends SpelNodeImpl {
|
||||
return this.constant;
|
||||
}
|
||||
else {
|
||||
Map<Object, Object> returnValue = new LinkedHashMap<Object, Object>();
|
||||
Map<Object, Object> returnValue = new LinkedHashMap<>();
|
||||
int childcount = getChildCount();
|
||||
for (int c = 0; c < childcount; c++) {
|
||||
// TODO allow for key being PropertyOrFieldReference like Indexer on maps
|
||||
|
||||
@@ -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.
|
||||
@@ -161,7 +161,7 @@ public class MethodReference extends SpelNodeImpl {
|
||||
}
|
||||
|
||||
private List<TypeDescriptor> getArgumentTypes(Object... arguments) {
|
||||
List<TypeDescriptor> descriptors = new ArrayList<TypeDescriptor>(arguments.length);
|
||||
List<TypeDescriptor> descriptors = new ArrayList<>(arguments.length);
|
||||
for (Object argument : arguments) {
|
||||
descriptors.add(TypeDescriptor.forObject(argument));
|
||||
}
|
||||
|
||||
@@ -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 @@ import org.springframework.expression.spel.support.BooleanTypedValue;
|
||||
*/
|
||||
public class OperatorMatches extends Operator {
|
||||
|
||||
private final ConcurrentMap<String, Pattern> patternCache = new ConcurrentHashMap<String, Pattern>();
|
||||
private final ConcurrentMap<String, Pattern> patternCache = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public OperatorMatches(int pos, SpelNodeImpl... operands) {
|
||||
|
||||
@@ -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.
|
||||
@@ -71,7 +71,7 @@ public class Projection extends SpelNodeImpl {
|
||||
// eg. {'a':'y','b':'n'}.![value=='y'?key:null]" == ['a', null]
|
||||
if (operand instanceof Map) {
|
||||
Map<?, ?> mapData = (Map<?, ?>) operand;
|
||||
List<Object> result = new ArrayList<Object>();
|
||||
List<Object> result = new ArrayList<>();
|
||||
for (Map.Entry<?, ?> entry : mapData.entrySet()) {
|
||||
try {
|
||||
state.pushActiveContextObject(new TypedValue(entry));
|
||||
@@ -90,7 +90,7 @@ public class Projection extends SpelNodeImpl {
|
||||
Iterable<?> data = (operand instanceof Iterable ?
|
||||
(Iterable<?>) operand : Arrays.asList(ObjectUtils.toObjectArray(operand)));
|
||||
|
||||
List<Object> result = new ArrayList<Object>();
|
||||
List<Object> result = new ArrayList<>();
|
||||
int idx = 0;
|
||||
Class<?> arrayElementType = null;
|
||||
for (Object element : data) {
|
||||
|
||||
@@ -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.
|
||||
@@ -306,8 +306,8 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
|
||||
private List<PropertyAccessor> getPropertyAccessorsToTry(Object contextObject, List<PropertyAccessor> propertyAccessors) {
|
||||
Class<?> targetType = (contextObject != null ? contextObject.getClass() : null);
|
||||
|
||||
List<PropertyAccessor> specificAccessors = new ArrayList<PropertyAccessor>();
|
||||
List<PropertyAccessor> generalAccessors = new ArrayList<PropertyAccessor>();
|
||||
List<PropertyAccessor> specificAccessors = new ArrayList<>();
|
||||
List<PropertyAccessor> generalAccessors = new ArrayList<>();
|
||||
for (PropertyAccessor resolver : propertyAccessors) {
|
||||
Class<?>[] targets = resolver.getSpecificTargetClasses();
|
||||
if (targets == null) {
|
||||
@@ -326,7 +326,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PropertyAccessor> resolvers = new ArrayList<PropertyAccessor>();
|
||||
List<PropertyAccessor> resolvers = new ArrayList<>();
|
||||
resolvers.addAll(specificAccessors);
|
||||
generalAccessors.removeAll(specificAccessors);
|
||||
resolvers.addAll(generalAccessors);
|
||||
|
||||
@@ -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.
|
||||
@@ -80,7 +80,7 @@ public class Selection extends SpelNodeImpl {
|
||||
if (operand instanceof Map) {
|
||||
Map<?, ?> mapdata = (Map<?, ?>) operand;
|
||||
// TODO don't lose generic info for the new map
|
||||
Map<Object, Object> result = new HashMap<Object, Object>();
|
||||
Map<Object, Object> result = new HashMap<>();
|
||||
Object lastKey = null;
|
||||
|
||||
for (Map.Entry<?, ?> entry : mapdata.entrySet()) {
|
||||
@@ -115,7 +115,7 @@ public class Selection extends SpelNodeImpl {
|
||||
}
|
||||
|
||||
if (this.variant == LAST) {
|
||||
Map<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||
Map<Object, Object> resultMap = new HashMap<>();
|
||||
Object lastValue = result.get(lastKey);
|
||||
resultMap.put(lastKey,lastValue);
|
||||
return new ValueRef.TypedValueHolderValueRef(new TypedValue(resultMap),this);
|
||||
@@ -128,7 +128,7 @@ public class Selection extends SpelNodeImpl {
|
||||
Iterable<?> data = (operand instanceof Iterable ?
|
||||
(Iterable<?>) operand : Arrays.asList(ObjectUtils.toObjectArray(operand)));
|
||||
|
||||
List<Object> result = new ArrayList<Object>();
|
||||
List<Object> result = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (Object element : data) {
|
||||
try {
|
||||
|
||||
@@ -90,7 +90,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
private final SpelParserConfiguration configuration;
|
||||
|
||||
// For rules that build nodes, they are stacked here for return
|
||||
private final Stack<SpelNodeImpl> constructedNodes = new Stack<SpelNodeImpl>();
|
||||
private final Stack<SpelNodeImpl> constructedNodes = new Stack<>();
|
||||
|
||||
// The expression being parsed
|
||||
private String expressionString;
|
||||
@@ -339,7 +339,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
|
||||
// primaryExpression : startNode (node)? -> ^(EXPRESSION startNode (node)?);
|
||||
private SpelNodeImpl eatPrimaryExpression() {
|
||||
List<SpelNodeImpl> nodes = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> nodes = new ArrayList<>();
|
||||
SpelNodeImpl start = eatStartNode(); // always a start node
|
||||
nodes.add(start);
|
||||
while (maybeEatNode()) {
|
||||
@@ -439,7 +439,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
if (!peekToken(TokenKind.LPAREN)) {
|
||||
return null;
|
||||
}
|
||||
List<SpelNodeImpl> args = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> args = new ArrayList<>();
|
||||
consumeArguments(args);
|
||||
eatToken(TokenKind.RPAREN);
|
||||
return args.toArray(new SpelNodeImpl[args.size()]);
|
||||
@@ -637,13 +637,13 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
// ':' - this is a map!
|
||||
|
||||
if (peekToken(TokenKind.RCURLY)) { // list with one item in it
|
||||
List<SpelNodeImpl> listElements = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> listElements = new ArrayList<>();
|
||||
listElements.add(firstExpression);
|
||||
closingCurly = eatToken(TokenKind.RCURLY);
|
||||
expr = new InlineList(toPos(t.startPos,closingCurly.endPos),listElements.toArray(new SpelNodeImpl[listElements.size()]));
|
||||
}
|
||||
else if (peekToken(TokenKind.COMMA, true)) { // multi item list
|
||||
List<SpelNodeImpl> listElements = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> listElements = new ArrayList<>();
|
||||
listElements.add(firstExpression);
|
||||
do {
|
||||
listElements.add(eatExpression());
|
||||
@@ -654,7 +654,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
|
||||
}
|
||||
else if (peekToken(TokenKind.COLON, true)) { // map!
|
||||
List<SpelNodeImpl> mapElements = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> mapElements = new ArrayList<>();
|
||||
mapElements.add(firstExpression);
|
||||
mapElements.add(eatExpression());
|
||||
while (peekToken(TokenKind.COMMA,true)) {
|
||||
@@ -712,7 +712,7 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
* TODO AndyC Could create complete identifiers (a.b.c) here rather than a sequence of them? (a, b, c)
|
||||
*/
|
||||
private SpelNodeImpl eatPossiblyQualifiedId() {
|
||||
LinkedList<SpelNodeImpl> qualifiedIdPieces = new LinkedList<SpelNodeImpl>();
|
||||
LinkedList<SpelNodeImpl> qualifiedIdPieces = new LinkedList<>();
|
||||
Token node = peekToken();
|
||||
while (isValidQualifiedId(node)) {
|
||||
nextToken();
|
||||
@@ -774,11 +774,11 @@ class InternalSpelExpressionParser extends TemplateAwareExpressionParser {
|
||||
return true;
|
||||
}
|
||||
SpelNodeImpl possiblyQualifiedConstructorName = eatPossiblyQualifiedId();
|
||||
List<SpelNodeImpl> nodes = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> nodes = new ArrayList<>();
|
||||
nodes.add(possiblyQualifiedConstructorName);
|
||||
if (peekToken(TokenKind.LSQUARE)) {
|
||||
// array initializer
|
||||
List<SpelNodeImpl> dimensions = new ArrayList<SpelNodeImpl>();
|
||||
List<SpelNodeImpl> dimensions = new ArrayList<>();
|
||||
while (peekToken(TokenKind.LSQUARE,true)) {
|
||||
if (!peekToken(TokenKind.RSQUARE)) {
|
||||
dimensions.add(eatExpression());
|
||||
|
||||
@@ -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.
|
||||
@@ -72,7 +72,7 @@ public class SpelCompiler implements Opcodes {
|
||||
// A compiler is created for each classloader, it manages a child class loader of that
|
||||
// classloader and the child is used to load the compiled expressions.
|
||||
private static final Map<ClassLoader, SpelCompiler> compilers =
|
||||
new ConcurrentReferenceHashMap<ClassLoader, SpelCompiler>();
|
||||
new ConcurrentReferenceHashMap<>();
|
||||
|
||||
|
||||
// The child ClassLoader used to load the compiled expression classes
|
||||
|
||||
@@ -73,7 +73,7 @@ class Tokenizer {
|
||||
|
||||
int max;
|
||||
|
||||
List<Token> tokens = new ArrayList<Token>();
|
||||
List<Token> tokens = new ArrayList<>();
|
||||
|
||||
|
||||
public Tokenizer(String inputData) {
|
||||
|
||||
@@ -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.
|
||||
@@ -72,7 +72,7 @@ public class ReflectiveConstructorResolver implements ConstructorResolver {
|
||||
|
||||
for (Constructor<?> ctor : ctors) {
|
||||
Class<?>[] paramTypes = ctor.getParameterTypes();
|
||||
List<TypeDescriptor> paramDescriptors = new ArrayList<TypeDescriptor>(paramTypes.length);
|
||||
List<TypeDescriptor> paramDescriptors = new ArrayList<>(paramTypes.length);
|
||||
for (int i = 0; i < paramTypes.length; i++) {
|
||||
paramDescriptors.add(new TypeDescriptor(new MethodParameter(ctor, i)));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -82,7 +82,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
|
||||
|
||||
public void registerMethodFilter(Class<?> type, MethodFilter filter) {
|
||||
if (this.filters == null) {
|
||||
this.filters = new HashMap<Class<?>, MethodFilter>();
|
||||
this.filters = new HashMap<>();
|
||||
}
|
||||
if (filter != null) {
|
||||
this.filters.put(type, filter);
|
||||
@@ -109,13 +109,13 @@ public class ReflectiveMethodResolver implements MethodResolver {
|
||||
try {
|
||||
TypeConverter typeConverter = context.getTypeConverter();
|
||||
Class<?> type = (targetObject instanceof Class ? (Class<?>) targetObject : targetObject.getClass());
|
||||
List<Method> methods = new ArrayList<Method>(getMethods(type, targetObject));
|
||||
List<Method> methods = new ArrayList<>(getMethods(type, targetObject));
|
||||
|
||||
// If a filter is registered for this type, call it
|
||||
MethodFilter filter = (this.filters != null ? this.filters.get(type) : null);
|
||||
if (filter != null) {
|
||||
List<Method> filtered = filter.filter(methods);
|
||||
methods = (filtered instanceof ArrayList ? filtered : new ArrayList<Method>(filtered));
|
||||
methods = (filtered instanceof ArrayList ? filtered : new ArrayList<>(filtered));
|
||||
}
|
||||
|
||||
// Sort methods into a sensible order
|
||||
@@ -148,7 +148,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
|
||||
}
|
||||
|
||||
// Remove duplicate methods (possible due to resolved bridge methods)
|
||||
Set<Method> methodsToIterate = new LinkedHashSet<Method>(methods);
|
||||
Set<Method> methodsToIterate = new LinkedHashSet<>(methods);
|
||||
|
||||
Method closeMatch = null;
|
||||
int closeMatchDistance = Integer.MAX_VALUE;
|
||||
@@ -158,7 +158,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
|
||||
for (Method method : methodsToIterate) {
|
||||
if (method.getName().equals(name)) {
|
||||
Class<?>[] paramTypes = method.getParameterTypes();
|
||||
List<TypeDescriptor> paramDescriptors = new ArrayList<TypeDescriptor>(paramTypes.length);
|
||||
List<TypeDescriptor> paramDescriptors = new ArrayList<>(paramTypes.length);
|
||||
for (int i = 0; i < paramTypes.length; i++) {
|
||||
paramDescriptors.add(new TypeDescriptor(new MethodParameter(method, i)));
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
|
||||
|
||||
private Collection<Method> getMethods(Class<?> type, Object targetObject) {
|
||||
if (targetObject instanceof Class) {
|
||||
Set<Method> result = new LinkedHashSet<Method>();
|
||||
Set<Method> result = new LinkedHashSet<>();
|
||||
// Add these so that static methods are invocable on the type: e.g. Float.valueOf(..)
|
||||
Method[] methods = getMethods(type);
|
||||
for (Method method : methods) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
private static final Set<Class<?>> BOOLEAN_TYPES;
|
||||
|
||||
static {
|
||||
Set<Class<?>> booleanTypes = new HashSet<Class<?>>();
|
||||
Set<Class<?>> booleanTypes = new HashSet<>();
|
||||
booleanTypes.add(Boolean.class);
|
||||
booleanTypes.add(Boolean.TYPE);
|
||||
BOOLEAN_TYPES = Collections.unmodifiableSet(booleanTypes);
|
||||
@@ -70,13 +70,13 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
|
||||
|
||||
private final Map<PropertyCacheKey, InvokerPair> readerCache =
|
||||
new ConcurrentHashMap<PropertyCacheKey, InvokerPair>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<PropertyCacheKey, Member> writerCache =
|
||||
new ConcurrentHashMap<PropertyCacheKey, Member>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<PropertyCacheKey, TypeDescriptor> typeDescriptorCache =
|
||||
new ConcurrentHashMap<PropertyCacheKey, TypeDescriptor>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private InvokerPair lastReadInvokerPair;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -68,7 +68,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||
|
||||
private OperatorOverloader operatorOverloader = new StandardOperatorOverloader();
|
||||
|
||||
private final Map<String, Object> variables = new HashMap<String, Object>();
|
||||
private final Map<String, Object> variables = new HashMap<>();
|
||||
|
||||
|
||||
public StandardEvaluationContext() {
|
||||
@@ -252,7 +252,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||
|
||||
private synchronized void initializePropertyAccessors() {
|
||||
if (this.propertyAccessors == null) {
|
||||
List<PropertyAccessor> defaultAccessors = new ArrayList<PropertyAccessor>();
|
||||
List<PropertyAccessor> defaultAccessors = new ArrayList<>();
|
||||
defaultAccessors.add(new ReflectivePropertyAccessor());
|
||||
this.propertyAccessors = defaultAccessors;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||
|
||||
private synchronized void initializeMethodResolvers() {
|
||||
if (this.methodResolvers == null) {
|
||||
List<MethodResolver> defaultResolvers = new ArrayList<MethodResolver>();
|
||||
List<MethodResolver> defaultResolvers = new ArrayList<>();
|
||||
this.reflectiveMethodResolver = new ReflectiveMethodResolver();
|
||||
defaultResolvers.add(this.reflectiveMethodResolver);
|
||||
this.methodResolvers = defaultResolvers;
|
||||
@@ -281,7 +281,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||
|
||||
private synchronized void initializeConstructorResolvers() {
|
||||
if (this.constructorResolvers == null) {
|
||||
List<ConstructorResolver> defaultResolvers = new ArrayList<ConstructorResolver>();
|
||||
List<ConstructorResolver> defaultResolvers = new ArrayList<>();
|
||||
defaultResolvers.add(new ReflectiveConstructorResolver());
|
||||
this.constructorResolvers = defaultResolvers;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -39,7 +39,7 @@ public class StandardTypeLocator implements TypeLocator {
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
private final List<String> knownPackagePrefixes = new LinkedList<String>();
|
||||
private final List<String> knownPackagePrefixes = new LinkedList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user