parent
388e173ba3
commit
82fa4ef274
|
@ -36,9 +36,9 @@ public class OpEQ extends Operator {
|
|||
this.exitTypeDescriptor = "Z";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BooleanTypedValue getValueInternal(ExpressionState state)
|
||||
throws EvaluationException {
|
||||
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
|
||||
Object left = getLeftOperand().getValueInternal(state).getValue();
|
||||
Object right = getRightOperand().getValueInternal(state).getValue();
|
||||
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
|
||||
|
@ -86,11 +86,9 @@ public class OpEQ extends Operator {
|
|||
}
|
||||
|
||||
String operatorClassName = Operator.class.getName().replace('.', '/');
|
||||
String evaluationContextClassName = EvaluationContext.class.getName().replace('.',
|
||||
'/');
|
||||
mv.visitMethodInsn(INVOKESTATIC, operatorClassName, "equalityCheck", "(L"
|
||||
+ evaluationContextClassName + ";Ljava/lang/Object;Ljava/lang/Object;)Z",
|
||||
false);
|
||||
String evaluationContextClassName = EvaluationContext.class.getName().replace('.', '/');
|
||||
mv.visitMethodInsn(INVOKESTATIC, operatorClassName, "equalityCheck",
|
||||
"(L" + evaluationContextClassName + ";Ljava/lang/Object;Ljava/lang/Object;)Z", false);
|
||||
cf.pushDescriptor("Z");
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ public class OpNE extends Operator {
|
|||
this.exitTypeDescriptor = "Z";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BooleanTypedValue getValueInternal(ExpressionState state)
|
||||
throws EvaluationException {
|
||||
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
|
||||
Object left = getLeftOperand().getValueInternal(state).getValue();
|
||||
Object right = getRightOperand().getValueInternal(state).getValue();
|
||||
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
|
||||
|
@ -87,11 +87,9 @@ public class OpNE extends Operator {
|
|||
}
|
||||
|
||||
String operatorClassName = Operator.class.getName().replace('.', '/');
|
||||
String evaluationContextClassName = EvaluationContext.class.getName().replace('.',
|
||||
'/');
|
||||
mv.visitMethodInsn(INVOKESTATIC, operatorClassName, "equalityCheck", "(L"
|
||||
+ evaluationContextClassName + ";Ljava/lang/Object;Ljava/lang/Object;)Z",
|
||||
false);
|
||||
String evaluationContextClassName = EvaluationContext.class.getName().replace('.', '/');
|
||||
mv.visitMethodInsn(INVOKESTATIC, operatorClassName, "equalityCheck",
|
||||
"(L" + evaluationContextClassName + ";Ljava/lang/Object;Ljava/lang/Object;)Z", false);
|
||||
|
||||
// Invert the boolean
|
||||
Label notZero = new Label();
|
||||
|
|
|
@ -159,6 +159,16 @@ public abstract class Operator extends SpelNodeImpl {
|
|||
cf.pushDescriptor("Z");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform an equality check for the given operand values.
|
||||
* <p>This method is not just used for reflective comparisons in subclasses
|
||||
* but also from compiled expression code, which is why it needs to be
|
||||
* declared as {@code public static} here.
|
||||
* @param context the current evaluation context
|
||||
* @param left the left-hand operand value
|
||||
* @param right the right-hand operand value
|
||||
*/
|
||||
public static boolean equalityCheck(EvaluationContext context, Object left, Object right) {
|
||||
if (left instanceof Number && right instanceof Number) {
|
||||
Number leftNumber = (Number) left;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue