From 38a961c7b00fb6a6b2435773639605115c4221d4 Mon Sep 17 00:00:00 2001
From: "opensearch-trigger-bot[bot]"
 <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Date: Thu, 18 Jan 2024 18:39:16 -0500
Subject: [PATCH] Add @SuppressWarnings("removal") to not fail the build with
 -Werror for some JDKs (#11931) (#11934)

(cherry picked from commit 6dee9551738ab47c513d52c43b9d48da7b8df54d)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
---
 .../org/opensearch/test/rest/JsonLogsFormatAndParseIT.java    | 1 +
 .../azure/classic/AzureDiscoveryClusterFormationTests.java    | 1 +
 .../azure/classic/management/AzureComputeServiceImpl.java     | 1 +
 .../java/org/opensearch/discovery/ec2/Ec2NetworkTests.java    | 2 ++
 .../src/main/java/org/opensearch/cloud/gce/util/Access.java   | 1 +
 .../main/java/org/opensearch/ingest/attachment/TikaImpl.java  | 2 ++
 .../opensearch/repositories/azure/AzureStorageService.java    | 1 +
 .../gcs/GoogleCloudStorageRetryingInputStream.java            | 1 +
 .../java/org/opensearch/repositories/hdfs/HdfsPlugin.java     | 1 +
 .../java/org/opensearch/repositories/hdfs/HdfsRepository.java | 1 +
 .../org/opensearch/repositories/hdfs/HdfsSecurityContext.java | 1 +
 .../repositories/hdfs/HaHdfsFailoverTestSuiteIT.java          | 1 +
 .../repositories/hdfs/HdfsBlobStoreContainerTests.java        | 1 +
 .../repositories/s3/RepositoryCredentialsTests.java           | 1 +
 .../java/org/opensearch/telemetry/OTelTelemetrySettings.java  | 4 ++--
 .../opensearch/telemetry/metrics/OTelMetricsTelemetry.java    | 2 ++
 .../metrics/exporter/OTelMetricsExporterFactory.java          | 1 +
 .../opensearch/telemetry/tracing/OTelResourceProvider.java    | 1 +
 .../telemetry/tracing/exporter/OTelSpanExporterFactory.java   | 1 +
 .../org/opensearch/bootstrap/OpenSearchPolicyUnitTests.java   | 1 +
 .../java/org/opensearch/bootstrap/SystemCallFilterTests.java  | 1 +
 .../test/java/org/opensearch/plugins/PluginSecurityTests.java | 1 +
 .../opensearch/qa/custom_logging/CustomLoggingConfigIT.java   | 1 +
 .../unconfigured_node_name/JsonLogsFormatAndParseIT.java      | 1 +
 24 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/distribution/archives/integ-test-zip/src/test/java/org/opensearch/test/rest/JsonLogsFormatAndParseIT.java b/distribution/archives/integ-test-zip/src/test/java/org/opensearch/test/rest/JsonLogsFormatAndParseIT.java
index 88f667549f3e8..faef1441d0a02 100644
--- a/distribution/archives/integ-test-zip/src/test/java/org/opensearch/test/rest/JsonLogsFormatAndParseIT.java
+++ b/distribution/archives/integ-test-zip/src/test/java/org/opensearch/test/rest/JsonLogsFormatAndParseIT.java
@@ -51,6 +51,7 @@ protected Matcher<String> nodeNameMatcher() {
         return is("integTest-0");
     }
 
+    @SuppressWarnings("removal")
     @Override
     protected BufferedReader openReader(Path logFile) {
         assumeFalse("Skipping test because it is being run against an external cluster.",
diff --git a/plugins/discovery-azure-classic/src/internalClusterTest/java/org/opensearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java b/plugins/discovery-azure-classic/src/internalClusterTest/java/org/opensearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java
index ad622e68f5ccb..a4b733ec7d894 100644
--- a/plugins/discovery-azure-classic/src/internalClusterTest/java/org/opensearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java
+++ b/plugins/discovery-azure-classic/src/internalClusterTest/java/org/opensearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java
@@ -296,6 +296,7 @@ private static SSLContext getSSLContext() throws Exception {
      * The {@link HttpsServer} in the JDK has issues with TLSv1.3 when running in a JDK prior to
      * 12.0.1 so we pin to TLSv1.2 when running on an earlier JDK
      */
+    @SuppressWarnings("removal")
     private static String getProtocol() {
         if (Runtime.version().compareTo(Version.parse("12")) < 0) {
             return "TLSv1.2";
diff --git a/plugins/discovery-azure-classic/src/main/java/org/opensearch/cloud/azure/classic/management/AzureComputeServiceImpl.java b/plugins/discovery-azure-classic/src/main/java/org/opensearch/cloud/azure/classic/management/AzureComputeServiceImpl.java
index 1bac80e576199..6e21feca7f5fb 100644
--- a/plugins/discovery-azure-classic/src/main/java/org/opensearch/cloud/azure/classic/management/AzureComputeServiceImpl.java
+++ b/plugins/discovery-azure-classic/src/main/java/org/opensearch/cloud/azure/classic/management/AzureComputeServiceImpl.java
@@ -112,6 +112,7 @@ private static String getRequiredSetting(Settings settings, Setting<String> sett
         return value;
     }
 
+    @SuppressWarnings("removal")
     @Override
     public HostedServiceGetDetailedResponse getServiceDetails() {
         SpecialPermission.check();
diff --git a/plugins/discovery-ec2/src/test/java/org/opensearch/discovery/ec2/Ec2NetworkTests.java b/plugins/discovery-ec2/src/test/java/org/opensearch/discovery/ec2/Ec2NetworkTests.java
index b4ed613c0d8dd..9518fac442111 100644
--- a/plugins/discovery-ec2/src/test/java/org/opensearch/discovery/ec2/Ec2NetworkTests.java
+++ b/plugins/discovery-ec2/src/test/java/org/opensearch/discovery/ec2/Ec2NetworkTests.java
@@ -89,6 +89,7 @@ public static void startHttp() throws Exception {
         httpServer.start();
     }
 
+    @SuppressWarnings("removal")
     @Before
     public void setup() {
         // redirect EC2 metadata service to httpServer
@@ -116,6 +117,7 @@ public void testNetworkHostEc2() throws IOException {
     /**
      * Test for network.host: _ec2_
      */
+    @SuppressWarnings("removal")
     public void testNetworkHostUnableToResolveEc2() {
         // redirect EC2 metadata service to unknown location
         AccessController.doPrivileged(
diff --git a/plugins/discovery-gce/src/main/java/org/opensearch/cloud/gce/util/Access.java b/plugins/discovery-gce/src/main/java/org/opensearch/cloud/gce/util/Access.java
index 1401f7ca26ce6..c46bfedbd8507 100644
--- a/plugins/discovery-gce/src/main/java/org/opensearch/cloud/gce/util/Access.java
+++ b/plugins/discovery-gce/src/main/java/org/opensearch/cloud/gce/util/Access.java
@@ -48,6 +48,7 @@
  * {@code connect}. This class wraps the operations requiring access in
  * {@link AccessController#doPrivileged(PrivilegedAction)} blocks.
  */
+@SuppressWarnings("removal")
 public final class Access {
 
     private Access() {}
diff --git a/plugins/ingest-attachment/src/main/java/org/opensearch/ingest/attachment/TikaImpl.java b/plugins/ingest-attachment/src/main/java/org/opensearch/ingest/attachment/TikaImpl.java
index ce7ceb5e3d776..fe783e5ddb675 100644
--- a/plugins/ingest-attachment/src/main/java/org/opensearch/ingest/attachment/TikaImpl.java
+++ b/plugins/ingest-attachment/src/main/java/org/opensearch/ingest/attachment/TikaImpl.java
@@ -112,6 +112,7 @@ final class TikaImpl {
     /**
      * parses with tika, throwing any exception hit while parsing the document
      */
+    @SuppressWarnings("removal")
     static String parse(final byte content[], final Metadata metadata, final int limit) throws TikaException, IOException {
         // check that its not unprivileged code like a script
         SpecialPermission.check();
@@ -136,6 +137,7 @@ static String parse(final byte content[], final Metadata metadata, final int lim
 
     // apply additional containment for parsers, this is intersected with the current permissions
     // its hairy, but worth it so we don't have some XML flaw reading random crap from the FS
+    @SuppressWarnings("removal")
     private static final AccessControlContext RESTRICTED_CONTEXT = new AccessControlContext(
         new ProtectionDomain[] { new ProtectionDomain(null, getRestrictedPermissions()) }
     );
diff --git a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java
index b60701ba5e533..74edd4f3eb23c 100644
--- a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java
+++ b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java
@@ -389,6 +389,7 @@ private static class NioThreadFactory implements ThreadFactory {
         private final AtomicInteger threadNumber = new AtomicInteger(1);
         private final String namePrefix;
 
+        @SuppressWarnings("removal")
         NioThreadFactory() {
             SecurityManager s = System.getSecurityManager();
             group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
diff --git a/plugins/repository-gcs/src/main/java/org/opensearch/repositories/gcs/GoogleCloudStorageRetryingInputStream.java b/plugins/repository-gcs/src/main/java/org/opensearch/repositories/gcs/GoogleCloudStorageRetryingInputStream.java
index 22926199cd6a2..ef4a237a20f55 100644
--- a/plugins/repository-gcs/src/main/java/org/opensearch/repositories/gcs/GoogleCloudStorageRetryingInputStream.java
+++ b/plugins/repository-gcs/src/main/java/org/opensearch/repositories/gcs/GoogleCloudStorageRetryingInputStream.java
@@ -107,6 +107,7 @@ class GoogleCloudStorageRetryingInputStream extends InputStream {
         currentStream = openStream();
     }
 
+    @SuppressWarnings("removal")
     @SuppressForbidden(reason = "need access to storage client")
     private static com.google.api.services.storage.Storage getStorage(Storage client) {
         return AccessController.doPrivileged((PrivilegedAction<com.google.api.services.storage.Storage>) () -> {
diff --git a/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsPlugin.java b/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsPlugin.java
index 119d060374be2..af49cd3c579e6 100644
--- a/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsPlugin.java
+++ b/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsPlugin.java
@@ -52,6 +52,7 @@
 import java.util.Collections;
 import java.util.Map;
 
+@SuppressWarnings("removal")
 public final class HdfsPlugin extends Plugin implements RepositoryPlugin {
 
     // initialize some problematic classes with elevated privileges
diff --git a/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsRepository.java b/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsRepository.java
index f0ffec5713c1d..4b38e62b2525a 100644
--- a/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsRepository.java
+++ b/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsRepository.java
@@ -254,6 +254,7 @@ private static String getHostName() {
         }
     }
 
+    @SuppressWarnings("removal")
     @Override
     protected HdfsBlobStore createBlobStore() {
         // initialize our blobstore using elevated privileges.
diff --git a/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsSecurityContext.java b/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsSecurityContext.java
index 6f390ffafa925..bd02256d4a626 100644
--- a/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsSecurityContext.java
+++ b/plugins/repository-hdfs/src/main/java/org/opensearch/repositories/hdfs/HdfsSecurityContext.java
@@ -57,6 +57,7 @@
  * Keeps track of the current user for a given repository, as well as which
  * permissions to grant the blob store restricted execution methods.
  */
+@SuppressWarnings("removal")
 class HdfsSecurityContext {
 
     private static final Permission[] SIMPLE_AUTH_PERMISSIONS;
diff --git a/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HaHdfsFailoverTestSuiteIT.java b/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HaHdfsFailoverTestSuiteIT.java
index d0b63f17e3887..89ba8d51cf7f7 100644
--- a/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HaHdfsFailoverTestSuiteIT.java
+++ b/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HaHdfsFailoverTestSuiteIT.java
@@ -62,6 +62,7 @@
 /**
  * Integration test that runs against an HA-Enabled HDFS instance
  */
+@SuppressWarnings("removal")
 public class HaHdfsFailoverTestSuiteIT extends OpenSearchRestTestCase {
 
     public void testHAFailoverWithRepository() throws Exception {
diff --git a/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HdfsBlobStoreContainerTests.java b/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HdfsBlobStoreContainerTests.java
index 3a6eb0e205ccb..5f7454df4ecfc 100644
--- a/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HdfsBlobStoreContainerTests.java
+++ b/plugins/repository-hdfs/src/test/java/org/opensearch/repositories/hdfs/HdfsBlobStoreContainerTests.java
@@ -64,6 +64,7 @@
 @ThreadLeakFilters(filters = { HdfsClientThreadLeakFilter.class })
 public class HdfsBlobStoreContainerTests extends OpenSearchTestCase {
 
+    @SuppressWarnings("removal")
     private FileContext createTestContext() {
         FileContext fileContext;
         try {
diff --git a/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/RepositoryCredentialsTests.java b/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/RepositoryCredentialsTests.java
index 8e1926d40302f..f84d953baae8e 100644
--- a/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/RepositoryCredentialsTests.java
+++ b/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/RepositoryCredentialsTests.java
@@ -75,6 +75,7 @@
 import static org.hamcrest.Matchers.not;
 import static org.hamcrest.Matchers.notNullValue;
 
+@SuppressWarnings("removal")
 @SuppressForbidden(reason = "test requires to set a System property to allow insecure settings when running in IDE")
 public class RepositoryCredentialsTests extends OpenSearchSingleNodeTestCase implements ConfigPathSupport {
 
diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetrySettings.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetrySettings.java
index 8e23f724b4570..b31ed320d737e 100644
--- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetrySettings.java
+++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/OTelTelemetrySettings.java
@@ -66,7 +66,7 @@ private OTelTelemetrySettings() {}
     /**
      * Span Exporter type setting.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "removal" })
     public static final Setting<Class<SpanExporter>> OTEL_TRACER_SPAN_EXPORTER_CLASS_SETTING = new Setting<>(
         "telemetry.otel.tracer.span.exporter.class",
         LoggingSpanExporter.class.getName(),
@@ -90,7 +90,7 @@ private OTelTelemetrySettings() {}
     /**
      * Metrics Exporter type setting.
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "removal" })
     public static final Setting<Class<MetricExporter>> OTEL_METRICS_EXPORTER_CLASS_SETTING = new Setting<>(
         "telemetry.otel.metrics.exporter.class",
         LoggingMetricExporter.class.getName(),
diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/OTelMetricsTelemetry.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/OTelMetricsTelemetry.java
index 6160e5106c041..af235b9604669 100644
--- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/OTelMetricsTelemetry.java
+++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/OTelMetricsTelemetry.java
@@ -42,6 +42,7 @@ public OTelMetricsTelemetry(RefCountedReleasable<OpenTelemetrySdk> openTelemetry
         this.otelMeter = meterProvider.get(OTelTelemetryPlugin.INSTRUMENTATION_SCOPE_NAME);
     }
 
+    @SuppressWarnings("removal")
     @Override
     public Counter createCounter(String name, String description, String unit) {
         DoubleCounter doubleCounter = AccessController.doPrivileged(
@@ -54,6 +55,7 @@ public Counter createCounter(String name, String description, String unit) {
         return new OTelCounter(doubleCounter);
     }
 
+    @SuppressWarnings("removal")
     @Override
     public Counter createUpDownCounter(String name, String description, String unit) {
         DoubleUpDownCounter doubleUpDownCounter = AccessController.doPrivileged(
diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/exporter/OTelMetricsExporterFactory.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/exporter/OTelMetricsExporterFactory.java
index ef5a31e4003ca..9c548044484fd 100644
--- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/exporter/OTelMetricsExporterFactory.java
+++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/metrics/exporter/OTelMetricsExporterFactory.java
@@ -51,6 +51,7 @@ public static MetricExporter create(Settings settings) {
         return metricExporter;
     }
 
+    @SuppressWarnings("removal")
     private static MetricExporter instantiateExporter(Class<MetricExporter> exporterProviderClass) {
         try {
             // Check we ourselves are not being called by unprivileged code.
diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java
index 14a19f122c17b..b1a45f2e7c2d2 100644
--- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java
+++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelResourceProvider.java
@@ -48,6 +48,7 @@ private OTelResourceProvider() {}
      * @param settings cluster settings
      * @return OpenTelemetrySdk instance
      */
+    @SuppressWarnings("removal")
     public static OpenTelemetrySdk get(TelemetrySettings telemetrySettings, Settings settings) {
         return AccessController.doPrivileged(
             (PrivilegedAction<OpenTelemetrySdk>) () -> get(
diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/exporter/OTelSpanExporterFactory.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/exporter/OTelSpanExporterFactory.java
index da7ce5c47d9ca..e9d7e78882c7d 100644
--- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/exporter/OTelSpanExporterFactory.java
+++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/exporter/OTelSpanExporterFactory.java
@@ -51,6 +51,7 @@ public static SpanExporter create(Settings settings) {
         return spanExporter;
     }
 
+    @SuppressWarnings("removal")
     private static SpanExporter instantiateSpanExporter(Class<SpanExporter> spanExporterProviderClass) {
         try {
             // Check we ourselves are not being called by unprivileged code.
diff --git a/qa/evil-tests/src/test/java/org/opensearch/bootstrap/OpenSearchPolicyUnitTests.java b/qa/evil-tests/src/test/java/org/opensearch/bootstrap/OpenSearchPolicyUnitTests.java
index db532f9a1c503..4ea23e415c994 100644
--- a/qa/evil-tests/src/test/java/org/opensearch/bootstrap/OpenSearchPolicyUnitTests.java
+++ b/qa/evil-tests/src/test/java/org/opensearch/bootstrap/OpenSearchPolicyUnitTests.java
@@ -50,6 +50,7 @@
  * Unit tests for OpenSearchPolicy: these cannot run with security manager,
  * we don't allow messing with the policy
  */
+@SuppressWarnings("removal")
 public class OpenSearchPolicyUnitTests extends OpenSearchTestCase {
     /**
      * Test policy with null codesource.
diff --git a/qa/evil-tests/src/test/java/org/opensearch/bootstrap/SystemCallFilterTests.java b/qa/evil-tests/src/test/java/org/opensearch/bootstrap/SystemCallFilterTests.java
index 56d6c72705a78..99c9ee7e96d01 100644
--- a/qa/evil-tests/src/test/java/org/opensearch/bootstrap/SystemCallFilterTests.java
+++ b/qa/evil-tests/src/test/java/org/opensearch/bootstrap/SystemCallFilterTests.java
@@ -41,6 +41,7 @@ public class SystemCallFilterTests extends OpenSearchTestCase {
     /** command to try to run in tests */
     static final String EXECUTABLE = Constants.WINDOWS ? "calc" : "ls";
 
+    @SuppressWarnings("removal")
     @Override
     public void setUp() throws Exception {
         super.setUp();
diff --git a/qa/evil-tests/src/test/java/org/opensearch/plugins/PluginSecurityTests.java b/qa/evil-tests/src/test/java/org/opensearch/plugins/PluginSecurityTests.java
index 430df1f899708..04eae95f6fe12 100644
--- a/qa/evil-tests/src/test/java/org/opensearch/plugins/PluginSecurityTests.java
+++ b/qa/evil-tests/src/test/java/org/opensearch/plugins/PluginSecurityTests.java
@@ -41,6 +41,7 @@
 import static org.hamcrest.Matchers.containsInAnyOrder;
 
 /** Tests plugin manager security check */
+@SuppressWarnings("removal")
 public class PluginSecurityTests extends OpenSearchTestCase {
 
     /** Test that we can parse the set of permissions correctly for a simple policy */
diff --git a/qa/logging-config/src/test/java/org/opensearch/qa/custom_logging/CustomLoggingConfigIT.java b/qa/logging-config/src/test/java/org/opensearch/qa/custom_logging/CustomLoggingConfigIT.java
index 73c546b80d431..c2f799d7d48d2 100644
--- a/qa/logging-config/src/test/java/org/opensearch/qa/custom_logging/CustomLoggingConfigIT.java
+++ b/qa/logging-config/src/test/java/org/opensearch/qa/custom_logging/CustomLoggingConfigIT.java
@@ -62,6 +62,7 @@ public void testSuccessfulStartupWithCustomConfig() throws Exception {
         });
     }
 
+    @SuppressWarnings("removal")
     private List<String> readAllLines(Path logFile) {
         return AccessController.doPrivileged((PrivilegedAction<List<String>>) () -> {
             try {
diff --git a/qa/unconfigured-node-name/src/test/java/org/opensearch/unconfigured_node_name/JsonLogsFormatAndParseIT.java b/qa/unconfigured-node-name/src/test/java/org/opensearch/unconfigured_node_name/JsonLogsFormatAndParseIT.java
index d14c834405f32..8a6e5d62112c8 100644
--- a/qa/unconfigured-node-name/src/test/java/org/opensearch/unconfigured_node_name/JsonLogsFormatAndParseIT.java
+++ b/qa/unconfigured-node-name/src/test/java/org/opensearch/unconfigured_node_name/JsonLogsFormatAndParseIT.java
@@ -61,6 +61,7 @@ protected Matcher<String> nodeNameMatcher() {
         return equalTo(HOSTNAME);
     }
 
+    @SuppressWarnings("removal")
     @Override
     protected BufferedReader openReader(Path logFile) {
         return AccessController.doPrivileged((PrivilegedAction<BufferedReader>) () -> {