2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.common;
10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jdt.annotation.Nullable;
15 * Utility methods to hide operations that incur SpotBugs wrath used by public classes where we do not want to leak
16 * {@link SuppressFBWarnings}.
18 final class DoNotLeakSpotbugs {
19 private DoNotLeakSpotbugs() {
23 @SuppressFBWarnings(value = "ES_COMPARING_PARAMETER_STRING_WITH_EQ", justification = "Interning identity check")
24 static @Nullable String internedString(final @NonNull String str) {
25 final var interned = str.intern();
26 return interned == str ? null : interned;