Skip to content

Commit

Permalink
runtime-compute: Fix #657 make compose() return nullable expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Forslund committed May 30, 2018
1 parent c7756f9 commit 8269db6
Show file tree
Hide file tree
Showing 23 changed files with 505 additions and 1,585 deletions.
Expand Up @@ -317,7 +317,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToBigDecimal<V> compose(Function<? super V, ? extends T> before) { default <V> ToBigDecimalNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToBigDecimal(casted, this); return ComposedUtil.composeToBigDecimal(casted, this);
Expand Down
Expand Up @@ -113,6 +113,6 @@ default int compare(T first, T second) {
default <V> ToBigDecimalNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToBigDecimalNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToBigDecimalNullable(casted, this);
} }
} }
Expand Up @@ -126,7 +126,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToBoolean<V> compose(Function<? super V, ? extends T> before) { default <V> ToBooleanNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToBoolean(casted, this); return ComposedUtil.composeToBoolean(casted, this);
Expand Down
Expand Up @@ -207,6 +207,6 @@ default int compare(T first, T second) {
default <V> ToBooleanNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToBooleanNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToBooleanNullable(casted, this);
} }
} }
Expand Up @@ -318,7 +318,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToByte<V> compose(Function<? super V, ? extends T> before) { default <V> ToByteNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToByte(casted, this); return ComposedUtil.composeToByte(casted, this);
Expand Down
Expand Up @@ -227,6 +227,6 @@ default int compare(T first, T second) {
default <V> ToByteNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToByteNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToByteNullable(casted, this);
} }
} }
Expand Up @@ -125,7 +125,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToChar<V> compose(Function<? super V, ? extends T> before) { default <V> ToCharNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToChar(casted, this); return ComposedUtil.composeToChar(casted, this);
Expand Down
Expand Up @@ -119,6 +119,6 @@ default int compare(T first, T second) {
default <V> ToCharNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToCharNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToCharNullable(casted, this);
} }
} }
Expand Up @@ -325,7 +325,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToDouble<V> compose(Function<? super V, ? extends T> before) { default <V> ToDoubleNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToDouble(casted, this); return ComposedUtil.composeToDouble(casted, this);
Expand Down
Expand Up @@ -198,6 +198,6 @@ default int compare(T first, T second) {
default <V> ToDoubleNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToDoubleNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToDoubleNullable(casted, this);
} }
} }
Expand Up @@ -120,7 +120,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToEnum<V, E> compose(Function<? super V, ? extends T> before) { default <V> ToEnumNullable<V, E> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToEnum(casted, this); return ComposedUtil.composeToEnum(casted, this);
Expand Down
Expand Up @@ -245,6 +245,6 @@ default int compare(T first, T second) {
default <V> ToEnumNullable<V, E> compose(Function<? super V, ? extends T> before) { default <V> ToEnumNullable<V, E> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToEnumNullable(casted, this);
} }
} }
Expand Up @@ -319,7 +319,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToFloat<V> compose(Function<? super V, ? extends T> before) { default <V> ToFloatNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToFloat(casted, this); return ComposedUtil.composeToFloat(casted, this);
Expand Down
Expand Up @@ -232,6 +232,6 @@ default int compare(T first, T second) {
default <V> ToFloatNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToFloatNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToFloatNullable(casted, this);
} }
} }
Expand Up @@ -319,7 +319,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToInt<V> compose(Function<? super V, ? extends T> before) { default <V> ToIntNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToInt(casted, this); return ComposedUtil.composeToInt(casted, this);
Expand Down
Expand Up @@ -228,6 +228,6 @@ default int compare(T first, T second) {
default <V> ToIntNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToIntNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToIntNullable(casted, this);
} }
} }
Expand Up @@ -320,7 +320,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToLong<V> compose(Function<? super V, ? extends T> before) { default <V> ToLongNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToLong(casted, this); return ComposedUtil.composeToLong(casted, this);
Expand Down
Expand Up @@ -232,6 +232,6 @@ default int compare(T first, T second) {
default <V> ToLongNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToLongNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToLongNullable(casted, this);
} }
} }
Expand Up @@ -319,7 +319,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToShort<V> compose(Function<? super V, ? extends T> before) { default <V> ToShortNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToShort(casted, this); return ComposedUtil.composeToShort(casted, this);
Expand Down
Expand Up @@ -227,6 +227,6 @@ default int compare(T first, T second) {
default <V> ToShortNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToShortNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToShortNullable(casted, this);
} }
} }
Expand Up @@ -104,7 +104,7 @@ default int compare(T first, T second) {
} }


@Override @Override
default <V> ToString<V> compose(Function<? super V, ? extends T> before) { default <V> ToStringNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeToString(casted, this); return ComposedUtil.composeToString(casted, this);
Expand Down
Expand Up @@ -111,6 +111,6 @@ default int compare(T first, T second) {
default <V> ToStringNullable<V> compose(Function<? super V, ? extends T> before) { default <V> ToStringNullable<V> compose(Function<? super V, ? extends T> before) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Function<V, T> casted = (Function<V, T>) before; final Function<V, T> casted = (Function<V, T>) before;
return ComposedUtil.composeNullable(casted, this); return ComposedUtil.composeToStringNullable(casted, this);
} }
} }

0 comments on commit 8269db6

Please sign in to comment.