Remove APIs marked as deprecated for removal
Closes gh-33809
This commit is contained in:
@@ -211,69 +211,11 @@ public class ExpressionState {
|
||||
initScopeRootObjects().push(getActiveContextObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter a new scope with a new {@linkplain #getActiveContextObject() root
|
||||
* context object} and a new local variable scope containing the supplied
|
||||
* name/value pair.
|
||||
* @param name the name of the local variable
|
||||
* @param value the value of the local variable
|
||||
* @deprecated as of 6.2 with no replacement; to be removed in 7.0
|
||||
*/
|
||||
@Deprecated(since = "6.2", forRemoval = true)
|
||||
public void enterScope(String name, Object value) {
|
||||
initVariableScopes().push(new VariableScope(name, value));
|
||||
initScopeRootObjects().push(getActiveContextObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter a new scope with a new {@linkplain #getActiveContextObject() root
|
||||
* context object} and a new local variable scope containing the supplied
|
||||
* name/value pairs.
|
||||
* @param variables a map containing name/value pairs for local variables
|
||||
* @deprecated as of 6.2 with no replacement; to be removed in 7.0
|
||||
*/
|
||||
@Deprecated(since = "6.2", forRemoval = true)
|
||||
public void enterScope(@Nullable Map<String, Object> variables) {
|
||||
initVariableScopes().push(new VariableScope(variables));
|
||||
initScopeRootObjects().push(getActiveContextObject());
|
||||
}
|
||||
|
||||
public void exitScope() {
|
||||
initVariableScopes().pop();
|
||||
initScopeRootObjects().pop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a local variable with the given name to the supplied value within the
|
||||
* current scope.
|
||||
* <p>If a local variable with the given name already exists, it will be
|
||||
* overwritten.
|
||||
* @param name the name of the local variable
|
||||
* @param value the value of the local variable
|
||||
* @deprecated as of 6.2 with no replacement; to be removed in 7.0
|
||||
*/
|
||||
@Deprecated(since = "6.2", forRemoval = true)
|
||||
public void setLocalVariable(String name, Object value) {
|
||||
initVariableScopes().element().setVariable(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the value of the local variable with the given name.
|
||||
* @param name the name of the local variable
|
||||
* @return the value of the local variable, or {@code null} if the variable
|
||||
* does not exist in the current scope
|
||||
* @deprecated as of 6.2 with no replacement; to be removed in 7.0
|
||||
*/
|
||||
@Deprecated(since = "6.2", forRemoval = true)
|
||||
@Nullable
|
||||
public Object lookupLocalVariable(String name) {
|
||||
for (VariableScope scope : initVariableScopes()) {
|
||||
if (scope.definesVariable(name)) {
|
||||
return scope.lookupVariable(name);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Deque<TypedValue> initContextObjects() {
|
||||
if (this.contextObjects == null) {
|
||||
|
||||
@@ -123,17 +123,6 @@ public class Indexer extends SpelNodeImpl {
|
||||
private volatile CachedIndexState cachedIndexWriteState;
|
||||
|
||||
|
||||
/**
|
||||
* Create an {@code Indexer} with the given start position, end position, and
|
||||
* index expression.
|
||||
* @see #Indexer(boolean, int, int, SpelNodeImpl)
|
||||
* @deprecated as of 6.2, in favor of {@link #Indexer(boolean, int, int, SpelNodeImpl)}
|
||||
*/
|
||||
@Deprecated(since = "6.2", forRemoval = true)
|
||||
public Indexer(int startPos, int endPos, SpelNodeImpl indexExpression) {
|
||||
this(false, startPos, endPos, indexExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an {@code Indexer} with the given null-safe flag, start position,
|
||||
* end position, and index expression.
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.expression.spel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
@@ -55,21 +53,6 @@ class ExpressionStateTests extends AbstractExpressionTests {
|
||||
assertThat(state.getEvaluationContext()).isEqualTo(context);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void localVariables() {
|
||||
Object value = state.lookupLocalVariable("foo");
|
||||
assertThat(value).isNull();
|
||||
|
||||
state.setLocalVariable("foo",34);
|
||||
value = state.lookupLocalVariable("foo");
|
||||
assertThat(value).isEqualTo(34);
|
||||
|
||||
state.setLocalVariable("foo", null);
|
||||
value = state.lookupLocalVariable("foo");
|
||||
assertThat(value).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void globalVariables() {
|
||||
TypedValue typedValue = state.lookupVariable("foo");
|
||||
@@ -86,41 +69,6 @@ class ExpressionStateTests extends AbstractExpressionTests {
|
||||
assertThat(typedValue.getTypeDescriptor().getType()).isEqualTo(String.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void noVariableInterference() {
|
||||
TypedValue typedValue = state.lookupVariable("foo");
|
||||
assertThat(typedValue).isEqualTo(TypedValue.NULL);
|
||||
|
||||
state.setLocalVariable("foo",34);
|
||||
typedValue = state.lookupVariable("foo");
|
||||
assertThat(typedValue).isEqualTo(TypedValue.NULL);
|
||||
|
||||
state.setVariable("goo", "hello");
|
||||
assertThat(state.lookupLocalVariable("goo")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void localVariableNestedScopes() {
|
||||
assertThat(state.lookupLocalVariable("foo")).isNull();
|
||||
|
||||
state.setLocalVariable("foo",12);
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(12);
|
||||
|
||||
state.enterScope(null);
|
||||
// found in upper scope
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(12);
|
||||
|
||||
state.setLocalVariable("foo","abc");
|
||||
// found in nested scope
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo("abc");
|
||||
|
||||
state.exitScope();
|
||||
// found in nested scope
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(12);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rootContextObject() {
|
||||
assertThat(state.getRootContextObject().getValue().getClass()).isEqualTo(Inventor.class);
|
||||
@@ -159,25 +107,6 @@ class ExpressionStateTests extends AbstractExpressionTests {
|
||||
assertThat(state.getActiveContextObject()).isEqualTo(TypedValue.NULL);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void populatedNestedScopes() {
|
||||
assertThat(state.lookupLocalVariable("foo")).isNull();
|
||||
|
||||
state.enterScope("foo",34);
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(34);
|
||||
|
||||
state.enterScope(null);
|
||||
state.setLocalVariable("foo", 12);
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(12);
|
||||
|
||||
state.exitScope();
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(34);
|
||||
|
||||
state.exitScope();
|
||||
assertThat(state.lookupLocalVariable("goo")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void rootObjectConstructor() {
|
||||
EvaluationContext ctx = TestScenarioCreator.getTestEvaluationContext();
|
||||
@@ -189,27 +118,6 @@ class ExpressionStateTests extends AbstractExpressionTests {
|
||||
assertThat(stateRoot.getValue()).isEqualTo("i am a string");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void populatedNestedScopesMap() {
|
||||
assertThat(state.lookupLocalVariable("foo")).isNull();
|
||||
assertThat(state.lookupLocalVariable("goo")).isNull();
|
||||
|
||||
state.enterScope(Map.of("foo", 34, "goo", "abc"));
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(34);
|
||||
assertThat(state.lookupLocalVariable("goo")).isEqualTo("abc");
|
||||
|
||||
state.enterScope(null);
|
||||
state.setLocalVariable("foo",12);
|
||||
assertThat(state.lookupLocalVariable("foo")).isEqualTo(12);
|
||||
assertThat(state.lookupLocalVariable("goo")).isEqualTo("abc");
|
||||
|
||||
state.exitScope();
|
||||
state.exitScope();
|
||||
assertThat(state.lookupLocalVariable("foo")).isNull();
|
||||
assertThat(state.lookupLocalVariable("goo")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void operators() {
|
||||
assertThatExceptionOfType(SpelEvaluationException.class)
|
||||
|
||||
Reference in New Issue
Block a user