Fix new Sonar smells

* Remove redundant `@SafeVarargs` from `Disposables.add()` since
`DisposableBean` is a "reifiable" type
This commit is contained in:
Artem Bilan
2019-07-18 10:35:12 -04:00
parent c712416b63
commit 733b895544
2 changed files with 8 additions and 7 deletions

View File

@@ -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
}
});
}
}

View File

@@ -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(