Skip to content

Commit

Permalink
Add @SuppressWarnings("removal") to not fail the build with -Werror f…
Browse files Browse the repository at this point in the history
…or some JDKs

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed Jan 18, 2024
1 parent 904c9a9 commit c17acba
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public void shutdown() {
}
}

@SuppressWarnings("removal")
static class SnifferThreadFactory implements ThreadFactory {
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String namePrefix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Set<Property> getProperties() {
return properties;
}

@SuppressWarnings("removal")
private Map<String, Object> retrieveCityGeoData(InetAddress ipAddress) {
SpecialPermission.check();
CityResponse response = AccessController.doPrivileged(
Expand Down Expand Up @@ -305,6 +306,7 @@ private Map<String, Object> retrieveCityGeoData(InetAddress ipAddress) {
return geoData;
}

@SuppressWarnings("removal")
private Map<String, Object> retrieveCountryGeoData(InetAddress ipAddress) {
SpecialPermission.check();
CountryResponse response = AccessController.doPrivileged(
Expand Down Expand Up @@ -351,6 +353,7 @@ private Map<String, Object> retrieveCountryGeoData(InetAddress ipAddress) {
return geoData;
}

@SuppressWarnings("removal")
private Map<String, Object> retrieveAsnGeoData(InetAddress ipAddress) {
SpecialPermission.check();
AsnResponse response = AccessController.doPrivileged(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
* The idea is to mimic as much as possible what happens with ES in production
* mode (e.g. assign permissions and install security manager the same way)
*/
@SuppressWarnings("removal")
public class BootstrapForTesting {

// TODO: can we share more code with the non-test side here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* Mockito plugin which wraps the Mockito calls into priviledged execution blocks and respects
* SecurityManager presence.
*/
@SuppressWarnings("removal")
@SuppressForbidden(reason = "allow URL#getFile() to be used in tests")
public class PriviledgedMockMaker implements MockMaker {
private static AccessControlContext context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ public static synchronized void clear() {
private static final Logger LOGGER = LogManager.getLogger(FeatureFlagSetter.class);
private final Set<String> flags = ConcurrentCollections.newConcurrentSet();

@SuppressWarnings("removal")
@SuppressForbidden(reason = "Enables setting of feature flags")
private void setFlag(String flag) {
flags.add(flag);
AccessController.doPrivileged((PrivilegedAction<String>) () -> System.setProperty(flag, "true"));
LOGGER.info("set feature_flag={}", flag);
}

@SuppressWarnings("removal")
@SuppressForbidden(reason = "Clears the set feature flags")
private void clearAll() {
for (String flag : flags) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public TimeValue expectedTimeToHeal() {
* returns true if some live threads were found. The caller is expected to call this method
* until no more "live" are found.
*/
@SuppressWarnings("deprecation") // suspends/resumes threads intentionally
@SuppressWarnings({ "deprecation", "removal" }) // suspends/resumes threads intentionally
@SuppressForbidden(reason = "suspends/resumes threads intentionally")
protected boolean suspendThreads(Set<Thread> nodeThreads) {
Thread[] allThreads = null;
Expand Down Expand Up @@ -360,7 +360,7 @@ protected void onBlockDetected(ThreadInfo blockedThread, @Nullable ThreadInfo bl
);
}

@SuppressWarnings("deprecation") // suspends/resumes threads intentionally
@SuppressWarnings({ "deprecation", "removal" }) // suspends/resumes threads intentionally
@SuppressForbidden(reason = "suspends/resumes threads intentionally")
protected void resumeThreads(Set<Thread> threads) {
for (Thread thread : threads) {
Expand Down

0 comments on commit c17acba

Please sign in to comment.