"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-expression/src/main/java/org/springframework/expression/spel/ast/Ternary.java" between
spring-framework-5.3.23.tar.gz and spring-framework-5.3.24.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

Ternary.java  (spring-framework-5.3.23):Ternary.java  (spring-framework-5.3.24)
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * https://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
skipping to change at line 35 skipping to change at line 35
import org.springframework.expression.spel.SpelEvaluationException; import org.springframework.expression.spel.SpelEvaluationException;
import org.springframework.expression.spel.SpelMessage; import org.springframework.expression.spel.SpelMessage;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
/** /**
* Represents a ternary expression, for example: "someCheck()?true:false". * Represents a ternary expression, for example: "someCheck()?true:false".
* *
* @author Andy Clement * @author Andy Clement
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen
* @since 3.0 * @since 3.0
*/ */
public class Ternary extends SpelNodeImpl { public class Ternary extends SpelNodeImpl {
public Ternary(int startPos, int endPos, SpelNodeImpl... args) { public Ternary(int startPos, int endPos, SpelNodeImpl... args) {
super(startPos, endPos, args); super(startPos, endPos, args);
} }
/** /**
* Evaluate the condition and if true evaluate the first alternative, oth erwise * Evaluate the condition and if true evaluate the first alternative, oth erwise
skipping to change at line 64 skipping to change at line 65
throw new SpelEvaluationException(getChild(0).getStartPos ition(), throw new SpelEvaluationException(getChild(0).getStartPos ition(),
SpelMessage.TYPE_CONVERSION_ERROR, "null" , "boolean"); SpelMessage.TYPE_CONVERSION_ERROR, "null" , "boolean");
} }
TypedValue result = this.children[value ? 1 : 2].getValueInternal (state); TypedValue result = this.children[value ? 1 : 2].getValueInternal (state);
computeExitTypeDescriptor(); computeExitTypeDescriptor();
return result; return result;
} }
@Override @Override
public String toStringAST() { public String toStringAST() {
return getChild(0).toStringAST() + " ? " + getChild(1).toStringAS T() + " : " + getChild(2).toStringAST(); return "(" + getChild(0).toStringAST() + " ? " + getChild(1).toSt ringAST() + " : " + getChild(2).toStringAST() + ")";
} }
private void computeExitTypeDescriptor() { private void computeExitTypeDescriptor() {
if (this.exitTypeDescriptor == null && this.children[1].exitTypeD escriptor != null && if (this.exitTypeDescriptor == null && this.children[1].exitTypeD escriptor != null &&
this.children[2].exitTypeDescriptor != null) { this.children[2].exitTypeDescriptor != null) {
String leftDescriptor = this.children[1].exitTypeDescript or; String leftDescriptor = this.children[1].exitTypeDescript or;
String rightDescriptor = this.children[2].exitTypeDescrip tor; String rightDescriptor = this.children[2].exitTypeDescrip tor;
if (ObjectUtils.nullSafeEquals(leftDescriptor, rightDescr iptor)) { if (ObjectUtils.nullSafeEquals(leftDescriptor, rightDescr iptor)) {
this.exitTypeDescriptor = leftDescriptor; this.exitTypeDescriptor = leftDescriptor;
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)