[#2597] f1.concat(f2).toString() seems to render unnecessary cast expression

This commit is contained in:
Lukas Eder 2013-09-24 11:44:45 +02:00
parent 180b3a193b
commit f753ccd850

View File

@ -184,9 +184,17 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
}
@SuppressWarnings("unchecked")
@Override
public final <Z> Field<Z> cast(Class<Z> type) {
return cast(DefaultDataType.getDataType(null, type));
// [#2597] Prevent unnecessary casts
if (getType() == type) {
return (Field<Z>) this;
}
else {
return cast(DefaultDataType.getDataType(null, type));
}
}
// ------------------------------------------------------------------------