Apply "instanceof pattern matching" in additional locations

Closes gh-27696
This commit is contained in:
liuzhifei
2021-11-18 20:13:13 +08:00
committed by Sam Brannen
parent 6555d3b42d
commit 7021eb5bb1
3 changed files with 6 additions and 10 deletions

View File

@@ -76,8 +76,7 @@ public abstract class AbstractConfigurableMBeanInfoAssembler extends AbstractRef
if (mapValue instanceof ManagedNotification mn) {
return new ModelMBeanNotificationInfo[] {JmxMetadataUtils.convertToModelMBeanNotificationInfo(mn)};
}
else if (mapValue instanceof Collection) {
Collection<?> col = (Collection<?>) mapValue;
else if (mapValue instanceof Collection<?> col) {
List<ModelMBeanNotificationInfo> result = new ArrayList<>();
for (Object colValue : col) {
if (!(colValue instanceof ManagedNotification mn)) {