From 7ab3450d00b4175d303e2d304dbafbd1175081d4 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 31 May 2022 22:24:36 +0200 Subject: [PATCH] Explain SuppressFBWarnings We are accessing a generic field and SpotBugs does not grok the cast is safe. Change-Id: I39b1f4377545d1187de611fc1b9e2bfe3a862c0c Signed-off-by: Robert Varga --- .../netconf/client/NetconfClientSessionNegotiator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiator.java b/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiator.java index 68f2bef063..6a55bdb9aa 100644 --- a/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiator.java +++ b/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiator.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.netconf.client; import com.google.common.base.Strings; @@ -63,8 +62,9 @@ public class NetconfClientSessionNegotiator extends } @SuppressWarnings("checkstyle:IllegalCatch") + @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", + justification = "SpotBugs does not understand generic cast of sessionPreferences") @Override - @SuppressFBWarnings("BC_UNCONFIRMED_CAST") protected void handleMessage(final NetconfHelloMessage netconfMessage) throws NetconfDocumentedException { if (!ifNegotiatedAlready()) { LOG.debug("Server hello message received, starting negotiation on channel {}", channel); @@ -113,7 +113,8 @@ public class NetconfClientSessionNegotiator extends }); } - @SuppressFBWarnings("BC_UNCONFIRMED_CAST") + @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", + justification = "SpotBugs does not understand generic cast of sessionPreferences") private boolean shouldUseExi(final NetconfHelloMessage helloMsg) { return containsExi10Capability(helloMsg.getDocument()) && containsExi10Capability(sessionPreferences.getHelloMessage().getDocument()); -- 2.36.6