Avoid creating message arguments to Assert.isABC calls

See https://github.com/spring-projects/spring-framework/commit/67f184293b94c076b0474231f739a74f42d5ffa8
This commit is contained in:
Vladimir Sitnikov
2018-02-13 12:31:49 +01:00
committed by Juergen Hoeller
parent b449928691
commit 659f13be1c
8 changed files with 10 additions and 9 deletions
@@ -49,8 +49,9 @@ public abstract class ParameterizedTypeReference<T> {
Type type = parameterizedTypeReferenceSubclass.getGenericSuperclass();
Assert.isInstanceOf(ParameterizedType.class, type, "Type must be a parameterized type");
ParameterizedType parameterizedType = (ParameterizedType) type;
Assert.isTrue(parameterizedType.getActualTypeArguments().length == 1, "Number of type arguments must be 1");
this.type = parameterizedType.getActualTypeArguments()[0];
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
Assert.isTrue(actualTypeArguments.length == 1, "Number of type arguments must be 1");
this.type = actualTypeArguments[0];
}
private ParameterizedTypeReference(Type type) {
@@ -62,7 +62,7 @@ public abstract class TransformerUtils {
*/
public static void enableIndenting(Transformer transformer, int indentAmount) {
Assert.notNull(transformer, "Transformer must not be null");
Assert.isTrue(indentAmount > -1, "The indent amount cannot be less than zero : got " + indentAmount);
Assert.isTrue(indentAmount > -1, () -> "The indent amount cannot be less than zero : got " + indentAmount);
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
try {
// Xalan-specific, but this is the most common XSLT engine in any case