Browse Source

Avoid String allocations with Assert.state()

pull/29434/head
Sam Brannen 2 years ago
parent
commit
2afcf60566
  1. 3
      spring-messaging/src/main/java/org/springframework/messaging/rsocket/service/RSocketServiceMethod.java
  2. 3
      spring-web/src/main/java/org/springframework/web/service/invoker/HttpServiceMethod.java

3
spring-messaging/src/main/java/org/springframework/messaging/rsocket/service/RSocketServiceMethod.java

@ -229,7 +229,8 @@ final class RSocketServiceMethod { @@ -229,7 +229,8 @@ final class RSocketServiceMethod {
break;
}
}
Assert.state(resolved, formatArgumentError(this.parameters[i], "No suitable resolver"));
int index = i;
Assert.state(resolved, () -> formatArgumentError(this.parameters[index], "No suitable resolver"));
}
}

3
spring-web/src/main/java/org/springframework/web/service/invoker/HttpServiceMethod.java

@ -116,7 +116,8 @@ final class HttpServiceMethod { @@ -116,7 +116,8 @@ final class HttpServiceMethod {
break;
}
}
Assert.state(resolved, formatArgumentError(this.parameters[i], "No suitable resolver"));
int index = i;
Assert.state(resolved, () -> formatArgumentError(this.parameters[index], "No suitable resolver"));
}
}

Loading…
Cancel
Save