Fix new Sonar smells
* Remove redundant `@SafeVarargs` from `Disposables.add()` since `DisposableBean` is a "reifiable" type
This commit is contained in:
@@ -29,6 +29,8 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
* case, the container does not automatically dispose of them.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.1
|
||||
*
|
||||
*/
|
||||
@@ -36,21 +38,20 @@ class Disposables implements DisposableBean {
|
||||
|
||||
private final List<DisposableBean> disposables = new ArrayList<>();
|
||||
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
public final void add(DisposableBean... disposablesToAdd) {
|
||||
this.disposables.addAll(Arrays.asList(disposablesToAdd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
this.disposables.forEach(d -> {
|
||||
this.disposables.forEach((disposable) -> {
|
||||
try {
|
||||
d.destroy();
|
||||
disposable.destroy();
|
||||
}
|
||||
catch (@SuppressWarnings("unused") Exception e) {
|
||||
catch (@SuppressWarnings("unused") Exception ex) {
|
||||
// NOSONAR
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ public class LambdaMessageProcessor implements MessageProcessor<Object>, BeanFac
|
||||
"An example of when this often occurs is if the lambda is configured to " +
|
||||
"receive a Message<?> argument.", e.getCause());
|
||||
}
|
||||
throw new IllegalStateException(
|
||||
"Could not invoke the method '" + this.method + "'", e.getCause()); // NOSONAR lost stack trace
|
||||
throw new IllegalStateException( // NOSONAR lost stack trace
|
||||
"Could not invoke the method '" + this.method + "'", e.getCause());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException(
|
||||
|
||||
Reference in New Issue
Block a user