[jOOQ/jOOQ#9196] Only change Field#add(Field) for non-numeric fields

`a.plus(b).plus(c)` will only for numeric fields be rendered as `(a + b
+ c)` and for non-numeric fields as `((a + b) + c)`. This thus again
restores the original behavior for numeric fields.
This commit is contained in:
Knut Wannheden 2019-09-27 10:36:12 +02:00
parent 21fb32d58a
commit b7c1291282

View File

@ -133,9 +133,19 @@ final class Expression<T> extends AbstractField<T> {
this.arguments = Tools.combine(lhs, rhs);
}
@Override
public final Field<T> add(Field<?> value) {
if (operator == ExpressionOperator.ADD && getDataType().isNumeric()) {
rhs.add(value);
return this;
}
return super.add(value);
}
@Override
public final Field<T> mul(Field<? extends Number> value) {
if (operator == ExpressionOperator.MULTIPLY) {
if (operator == ExpressionOperator.MULTIPLY && getDataType().isNumeric()) {
rhs.add(value);
return this;
}