Consistently use tabs rather than spaces
Update code that has accidentally used spaces instead of tabs. Also remove all trailing whitespace. Issue: SPR-16968
This commit is contained in:
committed by
Juergen Hoeller
parent
be85bd8e09
commit
5cedd0d5d4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -27,13 +27,13 @@ import org.springframework.expression.spel.SpelMessage;
|
||||
/**
|
||||
* Represents a bean reference to a type, for example <tt>@foo</tt> or <tt>@'foo.bar'</tt>.
|
||||
* For a FactoryBean the syntax <tt>&foo</tt> can be used to access the factory itself.
|
||||
*
|
||||
*
|
||||
* @author Andy Clement
|
||||
*/
|
||||
public class BeanReference extends SpelNodeImpl {
|
||||
|
||||
private static final String FACTORY_BEAN_PREFIX = "&";
|
||||
|
||||
|
||||
private final String beanName;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 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,16 +42,16 @@ public class BooleanLiteral extends Literal {
|
||||
public BooleanTypedValue getLiteralValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
if (this.value == BooleanTypedValue.TRUE) {
|
||||
mv.visitLdcInsn(1);
|
||||
mv.visitLdcInsn(1);
|
||||
}
|
||||
else {
|
||||
mv.visitLdcInsn(0);
|
||||
|
||||
@@ -161,7 +161,7 @@ public class ConstructorReference extends SpelNodeImpl {
|
||||
if (executorToUse instanceof ReflectiveConstructorExecutor) {
|
||||
this.exitTypeDescriptor = CodeFlow.toDescriptor(
|
||||
((ReflectiveConstructorExecutor) executorToUse).getConstructor().getDeclaringClass());
|
||||
|
||||
|
||||
}
|
||||
return executorToUse.execute(state.getEvaluationContext(), arguments);
|
||||
}
|
||||
@@ -422,10 +422,10 @@ public class ConstructorReference extends SpelNodeImpl {
|
||||
private boolean hasInitializer() {
|
||||
return (getChildCount() > 1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
if (!(this.cachedExecutor instanceof ReflectiveConstructorExecutor) ||
|
||||
if (!(this.cachedExecutor instanceof ReflectiveConstructorExecutor) ||
|
||||
this.exitTypeDescriptor == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ public class ConstructorReference extends SpelNodeImpl {
|
||||
return (Modifier.isPublic(constructor.getModifiers()) &&
|
||||
Modifier.isPublic(constructor.getDeclaringClass().getModifiers()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
ReflectiveConstructorExecutor executor = ((ReflectiveConstructorExecutor) this.cachedExecutor);
|
||||
@@ -460,7 +460,7 @@ public class ConstructorReference extends SpelNodeImpl {
|
||||
// children[0] is the type of the constructor, don't want to include that in argument processing
|
||||
SpelNodeImpl[] arguments = new SpelNodeImpl[this.children.length - 1];
|
||||
System.arraycopy(this.children, 1, arguments, 0, this.children.length - 1);
|
||||
generateCodeForArguments(mv, cf, constructor, arguments);
|
||||
generateCodeForArguments(mv, cf, constructor, arguments);
|
||||
mv.visitMethodInsn(INVOKESPECIAL, classDesc, "<init>", CodeFlow.createSignatureDescriptor(constructor), false);
|
||||
cf.pushDescriptor(this.exitTypeDescriptor);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -48,7 +48,7 @@ public class FloatLiteral extends Literal {
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
mv.visitLdcInsn(this.value.getValue());
|
||||
|
||||
@@ -163,7 +163,7 @@ public class FunctionReference extends SpelNodeImpl {
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
Method method = this.method;
|
||||
@@ -182,8 +182,8 @@ public class FunctionReference extends SpelNodeImpl {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
Method method = this.method;
|
||||
Assert.state(method != null, "No method handle");
|
||||
|
||||
@@ -190,7 +190,7 @@ public class Indexer extends SpelNodeImpl {
|
||||
throw new SpelEvaluationException(
|
||||
getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, targetDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
if (this.indexedType == IndexedType.ARRAY) {
|
||||
@@ -210,7 +210,7 @@ public class Indexer extends SpelNodeImpl {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
String descriptor = cf.lastDescriptor();
|
||||
@@ -249,7 +249,7 @@ public class Indexer extends SpelNodeImpl {
|
||||
mv.visitTypeInsn(CHECKCAST, "[C");
|
||||
insn = CALOAD;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
mv.visitTypeInsn(CHECKCAST, "["+ this.exitTypeDescriptor +
|
||||
(CodeFlow.isPrimitiveArray(this.exitTypeDescriptor) ? "" : ";"));
|
||||
//depthPlusOne(exitTypeDescriptor)+"Ljava/lang/Object;");
|
||||
@@ -286,7 +286,7 @@ public class Indexer extends SpelNodeImpl {
|
||||
}
|
||||
mv.visitMethodInsn(
|
||||
INVOKEINTERFACE, "java/util/Map", "get", "(Ljava/lang/Object;)Ljava/lang/Object;", true);
|
||||
}
|
||||
}
|
||||
|
||||
else if (this.indexedType == IndexedType.OBJECT) {
|
||||
ReflectivePropertyAccessor.OptimalPropertyAccessor accessor =
|
||||
@@ -313,7 +313,7 @@ public class Indexer extends SpelNodeImpl {
|
||||
mv.visitFieldInsn((isStatic ? GETSTATIC : GETFIELD), classDesc, member.getName(),
|
||||
CodeFlow.toJvmDescriptor(((Field) member).getType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cf.pushDescriptor(this.exitTypeDescriptor);
|
||||
}
|
||||
|
||||
@@ -128,12 +128,12 @@ public class InlineList extends SpelNodeImpl {
|
||||
Assert.state(this.constant != null, "No constant");
|
||||
return (List<Object>) this.constant.getValue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return isConstant();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow codeflow) {
|
||||
final String constantFieldName = "inlineList$" + codeflow.nextFieldId();
|
||||
@@ -144,11 +144,11 @@ public class InlineList extends SpelNodeImpl {
|
||||
|
||||
codeflow.registerNewClinit((mVisitor, cflow) ->
|
||||
generateClinitCode(className, constantFieldName, mVisitor, cflow, false));
|
||||
|
||||
|
||||
mv.visitFieldInsn(GETSTATIC, className, constantFieldName, "Ljava/util/List;");
|
||||
codeflow.pushDescriptor("Ljava/util/List");
|
||||
}
|
||||
|
||||
|
||||
void generateClinitCode(String clazzname, String constantFieldName, MethodVisitor mv, CodeFlow codeflow, boolean nested) {
|
||||
mv.visitTypeInsn(NEW, "java/util/ArrayList");
|
||||
mv.visitInsn(DUP);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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,7 +70,7 @@ public class InlineMap extends SpelNodeImpl {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!((c%2)==0 && (child instanceof PropertyOrFieldReference))) {
|
||||
else if (!((c%2)==0 && (child instanceof PropertyOrFieldReference))) {
|
||||
isConstant = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -48,7 +48,7 @@ public class IntLiteral extends Literal {
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
Integer intValue = (Integer) this.value.getValue();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 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,12 +42,12 @@ public class LongLiteral extends Literal {
|
||||
public TypedValue getLiteralValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
mv.visitLdcInsn(this.value.getValue());
|
||||
|
||||
@@ -301,7 +301,7 @@ public class MethodReference extends SpelNodeImpl {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
CachedMethodExecutor executorToCheck = this.cachedExecutor;
|
||||
@@ -332,7 +332,7 @@ public class MethodReference extends SpelNodeImpl {
|
||||
// Something on the stack when nothing is needed
|
||||
mv.visitInsn(POP);
|
||||
}
|
||||
|
||||
|
||||
if (CodeFlow.isPrimitive(descriptor)) {
|
||||
CodeFlow.insertBoxIfNecessary(mv, descriptor.charAt(0));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -48,7 +48,7 @@ public class NullLiteral extends Literal {
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
mv.visitInsn(ACONST_NULL);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -78,7 +78,7 @@ public class OpAnd extends Operator {
|
||||
CodeFlow.isBooleanCompatible(left.exitTypeDescriptor) &&
|
||||
CodeFlow.isBooleanCompatible(right.exitTypeDescriptor));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
// Pseudo: if (!leftOperandValue) { result=false; } else { result=rightOperandValue; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -95,13 +95,13 @@ public class OpDivide extends Operator {
|
||||
return false;
|
||||
}
|
||||
if (this.children.length > 1) {
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (this.exitTypeDescriptor != null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
getLeftOperand().generateCode(mv, cf);
|
||||
@@ -123,12 +123,12 @@ public class OpDivide extends Operator {
|
||||
case 'J':
|
||||
mv.visitInsn(LDIV);
|
||||
break;
|
||||
case 'F':
|
||||
case 'F':
|
||||
mv.visitInsn(FDIV);
|
||||
break;
|
||||
case 'D':
|
||||
mv.visitInsn(DDIV);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(
|
||||
"Unrecognized exit type descriptor: '" + this.exitTypeDescriptor + "'");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -49,7 +49,7 @@ public class OpGE extends Operator {
|
||||
|
||||
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
|
||||
this.rightActualDescriptor = CodeFlow.toDescriptorFromObject(right);
|
||||
|
||||
|
||||
if (left instanceof Number && right instanceof Number) {
|
||||
Number leftNumber = (Number) left;
|
||||
Number rightNumber = (Number) right;
|
||||
@@ -90,12 +90,12 @@ public class OpGE extends Operator {
|
||||
|
||||
return BooleanTypedValue.forValue(state.getTypeComparator().compare(left, right) >= 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return isCompilableOperatorUsingNumerics();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
generateComparisonCode(mv, cf, IFLT, IF_ICMPLT);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -49,7 +49,7 @@ public class OpGT extends Operator {
|
||||
|
||||
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
|
||||
this.rightActualDescriptor = CodeFlow.toDescriptorFromObject(right);
|
||||
|
||||
|
||||
if (left instanceof Number && right instanceof Number) {
|
||||
Number leftNumber = (Number) left;
|
||||
Number rightNumber = (Number) right;
|
||||
@@ -100,7 +100,7 @@ public class OpGT extends Operator {
|
||||
public boolean isCompilable() {
|
||||
return isCompilableOperatorUsingNumerics();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
generateComparisonCode(mv, cf, IFLE, IF_ICMPLE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -49,7 +49,7 @@ public class OpLE extends Operator {
|
||||
|
||||
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
|
||||
this.rightActualDescriptor = CodeFlow.toDescriptorFromObject(right);
|
||||
|
||||
|
||||
if (left instanceof Number && right instanceof Number) {
|
||||
Number leftNumber = (Number) left;
|
||||
Number rightNumber = (Number) right;
|
||||
@@ -90,12 +90,12 @@ public class OpLE extends Operator {
|
||||
|
||||
return BooleanTypedValue.forValue(state.getTypeComparator().compare(left, right) <= 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return isCompilableOperatorUsingNumerics();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
generateComparisonCode(mv, cf, IFGT, IF_ICMPGT);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -95,12 +95,12 @@ public class OpLT extends Operator {
|
||||
|
||||
return BooleanTypedValue.forValue(state.getTypeComparator().compare(left, right) < 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return isCompilableOperatorUsingNumerics();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
generateComparisonCode(mv, cf, IFGE, IF_ICMPGE);
|
||||
|
||||
@@ -93,9 +93,9 @@ public class OpModulus extends Operator {
|
||||
return false;
|
||||
}
|
||||
if (this.children.length > 1) {
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (this.exitTypeDescriptor != null);
|
||||
}
|
||||
@@ -121,12 +121,12 @@ public class OpModulus extends Operator {
|
||||
case 'J':
|
||||
mv.visitInsn(LREM);
|
||||
break;
|
||||
case 'F':
|
||||
case 'F':
|
||||
mv.visitInsn(FREM);
|
||||
break;
|
||||
case 'D':
|
||||
mv.visitInsn(DREM);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(
|
||||
"Unrecognized exit type descriptor: '" + this.exitTypeDescriptor + "'");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -126,13 +126,13 @@ public class OpMultiply extends Operator {
|
||||
return false;
|
||||
}
|
||||
if (this.children.length > 1) {
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (this.exitTypeDescriptor != null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
getLeftOperand().generateCode(mv, cf);
|
||||
@@ -154,12 +154,12 @@ public class OpMultiply extends Operator {
|
||||
case 'J':
|
||||
mv.visitInsn(LMUL);
|
||||
break;
|
||||
case 'F':
|
||||
case 'F':
|
||||
mv.visitInsn(FMUL);
|
||||
break;
|
||||
case 'D':
|
||||
mv.visitInsn(DMUL);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(
|
||||
"Unrecognized exit type descriptor: '" + this.exitTypeDescriptor + "'");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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 OpOr extends Operator {
|
||||
CodeFlow.isBooleanCompatible(left.exitTypeDescriptor) &&
|
||||
CodeFlow.isBooleanCompatible(right.exitTypeDescriptor));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
// pseudo: if (leftOperandValue) { result=true; } else { result=rightOperandValue; }
|
||||
@@ -98,5 +98,5 @@ public class OpOr extends Operator {
|
||||
mv.visitLabel(endOfIf);
|
||||
cf.pushDescriptor(this.exitTypeDescriptor);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -178,9 +178,9 @@ public class OpPlus extends Operator {
|
||||
return false;
|
||||
}
|
||||
if (this.children.length > 1) {
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
if (!getRightOperand().isCompilable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (this.exitTypeDescriptor != null);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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 OperatorInstanceof extends Operator {
|
||||
|
||||
@Nullable
|
||||
private Class<?> type;
|
||||
|
||||
|
||||
|
||||
public OperatorInstanceof(int pos, SpelNodeImpl... operands) {
|
||||
super("instanceof", pos, operands);
|
||||
@@ -76,7 +76,7 @@ public class OperatorInstanceof extends Operator {
|
||||
}
|
||||
this.type = rightClass;
|
||||
if (rightOperand instanceof TypeReference) {
|
||||
// Can only generate bytecode where the right operand is a direct type reference,
|
||||
// Can only generate bytecode where the right operand is a direct type reference,
|
||||
// not if it is indirect (for example when right operand is a variable reference)
|
||||
this.exitTypeDescriptor = "Z";
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class OperatorInstanceof extends Operator {
|
||||
public boolean isCompilable() {
|
||||
return (this.exitTypeDescriptor != null && getLeftOperand().isCompilable());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
getLeftOperand().generateCode(mv, cf);
|
||||
@@ -98,7 +98,7 @@ public class OperatorInstanceof extends Operator {
|
||||
// in case it had side effects
|
||||
mv.visitInsn(POP);
|
||||
mv.visitInsn(ICONST_0); // value of false
|
||||
}
|
||||
}
|
||||
else {
|
||||
mv.visitTypeInsn(INSTANCEOF, Type.getInternalName(this.type));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -60,20 +60,20 @@ public class OperatorNot extends SpelNodeImpl { // Not is a unary operator so d
|
||||
public String toStringAST() {
|
||||
return "!" + getChild(0).toStringAST();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
SpelNodeImpl child = this.children[0];
|
||||
return (child.isCompilable() && CodeFlow.isBooleanCompatible(child.exitTypeDescriptor));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
this.children[0].generateCode(mv, cf);
|
||||
cf.unboxBooleanIfNecessary(mv);
|
||||
Label elseTarget = new Label();
|
||||
Label endOfIf = new Label();
|
||||
mv.visitJumpInsn(IFNE,elseTarget);
|
||||
mv.visitJumpInsn(IFNE,elseTarget);
|
||||
mv.visitInsn(ICONST_1); // TRUE
|
||||
mv.visitJumpInsn(GOTO,endOfIf);
|
||||
mv.visitLabel(elseTarget);
|
||||
|
||||
@@ -328,14 +328,14 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
|
||||
resolvers.addAll(generalAccessors);
|
||||
return resolvers;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
PropertyAccessor accessorToUse = this.cachedReadAccessor;
|
||||
return (accessorToUse instanceof CompilablePropertyAccessor &&
|
||||
((CompilablePropertyAccessor) accessorToUse).isCompilable());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
PropertyAccessor accessorToUse = this.cachedReadAccessor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -47,7 +47,7 @@ public class RealLiteral extends Literal {
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
mv.visitLdcInsn(this.value.getValue());
|
||||
|
||||
@@ -194,7 +194,7 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||
|
||||
public abstract TypedValue getValueInternal(ExpressionState expressionState) throws EvaluationException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generate code that handles building the argument values for the specified method.
|
||||
* This method will take account of whether the invoked method is a varargs method
|
||||
@@ -222,12 +222,12 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||
// have been passed to satisfy the varargs and so something needs to be built.
|
||||
int p = 0; // Current supplied argument being processed
|
||||
int childCount = arguments.length;
|
||||
|
||||
|
||||
// Fulfill all the parameter requirements except the last one
|
||||
for (p = 0; p < paramDescriptors.length - 1; p++) {
|
||||
generateCodeForArgument(mv, cf, arguments[p], paramDescriptors[p]);
|
||||
}
|
||||
|
||||
|
||||
SpelNodeImpl lastChild = (childCount == 0 ? null : arguments[childCount - 1]);
|
||||
String arrayType = paramDescriptors[paramDescriptors.length - 1];
|
||||
// Determine if the final passed argument is already suitably packaged in array
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -49,12 +49,12 @@ public class StringLiteral extends Literal {
|
||||
public String toString() {
|
||||
return "'" + getLiteralValue().getValue() + "'";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
mv.visitLdcInsn(this.value.getValue());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -59,7 +59,7 @@ public class Ternary extends SpelNodeImpl {
|
||||
computeExitTypeDescriptor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toStringAST() {
|
||||
return getChild(0).toStringAST() + " ? " + getChild(1).toStringAST() + " : " + getChild(2).toStringAST();
|
||||
@@ -89,7 +89,7 @@ public class Ternary extends SpelNodeImpl {
|
||||
CodeFlow.isBooleanCompatible(condition.exitTypeDescriptor) &&
|
||||
left.exitTypeDescriptor != null && right.exitTypeDescriptor != null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
// May reach here without it computed if all elements are literals
|
||||
|
||||
@@ -78,7 +78,7 @@ public class VariableReference extends SpelNodeImpl {
|
||||
if (value == null || !Modifier.isPublic(value.getClass().getModifiers())) {
|
||||
// If the type is not public then when generateCode produces a checkcast to it
|
||||
// then an IllegalAccessError will occur.
|
||||
// If resorting to Object isn't sufficient, the hierarchy could be traversed for
|
||||
// If resorting to Object isn't sufficient, the hierarchy could be traversed for
|
||||
// the first public type.
|
||||
this.exitTypeDescriptor = "Ljava/lang/Object";
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class VariableReference extends SpelNodeImpl {
|
||||
public boolean isCompilable() {
|
||||
return (this.exitTypeDescriptor != null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateCode(MethodVisitor mv, CodeFlow cf) {
|
||||
if (this.name.equals(ROOT)) {
|
||||
|
||||
@@ -385,10 +385,10 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
@Nullable
|
||||
protected Method findGetterForProperty(String propertyName, Class<?> clazz, boolean mustBeStatic) {
|
||||
Method method = findMethodForProperty(getPropertyMethodSuffixes(propertyName),
|
||||
"get", clazz, mustBeStatic, 0, ANY_TYPES);
|
||||
"get", clazz, mustBeStatic, 0, ANY_TYPES);
|
||||
if (method == null) {
|
||||
method = findMethodForProperty(getPropertyMethodSuffixes(propertyName),
|
||||
"is", clazz, mustBeStatic, 0, BOOLEAN_TYPES);
|
||||
"is", clazz, mustBeStatic, 0, BOOLEAN_TYPES);
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||
@Override
|
||||
public TypeConverter getTypeConverter() {
|
||||
if (this.typeConverter == null) {
|
||||
this.typeConverter = new StandardTypeConverter();
|
||||
this.typeConverter = new StandardTypeConverter();
|
||||
}
|
||||
return this.typeConverter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user