Suppress unchecked cast

This commit is contained in:
Paul Campbell 2018-03-13 18:46:44 +00:00
parent ca83e1c244
commit 1992db49f1
3 changed files with 6 additions and 5 deletions

View file

@ -33,11 +33,11 @@ import java.util.function.Supplier;
*/ */
class FalseValueClause<T> implements Value.ValueClause<T> { class FalseValueClause<T> implements Value.ValueClause<T> {
protected static final Value.ValueClause FALSE = new FalseValueClause(); protected static final Value.ValueClause<?> FALSE = new FalseValueClause<>();
@Override @Override
public ValueSupplier<T> then(final Supplier<T> trueSupplier) { public ValueSupplier<T> then(final Supplier<T> trueSupplier) {
return new FalseValueSupplier(); return new FalseValueSupplier<>();
} }
@Override @Override

View file

@ -35,7 +35,7 @@ import java.util.function.Supplier;
*/ */
class TrueValueClause<T> implements Value.ValueClause<T> { class TrueValueClause<T> implements Value.ValueClause<T> {
protected static final Value.ValueClause TRUE = new TrueValueClause<>(); protected static final Value.ValueClause<?> TRUE = new TrueValueClause<>();
@Override @Override
public ValueSupplier<T> then(final Supplier<T> trueSupplier) { public ValueSupplier<T> then(final Supplier<T> trueSupplier) {

View file

@ -75,11 +75,12 @@ public interface Value {
* *
* @return a true or false value clause * @return a true or false value clause
*/ */
@SuppressWarnings("unchecked")
static <T> ValueClause<T> where(final boolean clause) { static <T> ValueClause<T> where(final boolean clause) {
if (clause) { if (clause) {
return TrueValueClause.TRUE; return (ValueClause<T>) TrueValueClause.TRUE;
} }
return FalseValueClause.FALSE; return (ValueClause<T>) FalseValueClause.FALSE;
} }
/** /**