Suppress deprecations for compiling on JDK 19/20
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -401,6 +401,7 @@ public final class ConcurrentLruCache<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // for Thread.getId() on JDK 19
|
||||
private static int getBufferIndex() {
|
||||
return ((int) Thread.currentThread().getId()) & BUFFERS_MASK;
|
||||
}
|
||||
@@ -415,6 +416,7 @@ public final class ConcurrentLruCache<K, V> {
|
||||
return (pending < MAX_PENDING_OPERATIONS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // for Thread.getId() on JDK 19
|
||||
void drain() {
|
||||
final int start = (int) Thread.currentThread().getId();
|
||||
final int end = start + BUFFER_COUNT;
|
||||
|
||||
@@ -868,6 +868,7 @@ public abstract class StringUtils {
|
||||
* @return a corresponding {@code Locale} instance, or {@code null} if none
|
||||
* @throws IllegalArgumentException in case of an invalid locale specification
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // for Locale constructors on JDK 19
|
||||
@Nullable
|
||||
public static Locale parseLocaleString(String localeString) {
|
||||
if (localeString.equals("")) {
|
||||
@@ -877,25 +878,25 @@ public abstract class StringUtils {
|
||||
if (!localeString.contains("_") && localeString.contains(" ")) {
|
||||
delimiter = " ";
|
||||
}
|
||||
final String[] tokens = localeString.split(delimiter, -1);
|
||||
String[] tokens = localeString.split(delimiter, -1);
|
||||
if (tokens.length == 1) {
|
||||
final String language = tokens[0];
|
||||
String language = tokens[0];
|
||||
validateLocalePart(language);
|
||||
return new Locale(language);
|
||||
}
|
||||
else if (tokens.length == 2) {
|
||||
final String language = tokens[0];
|
||||
String language = tokens[0];
|
||||
validateLocalePart(language);
|
||||
final String country = tokens[1];
|
||||
String country = tokens[1];
|
||||
validateLocalePart(country);
|
||||
return new Locale(language, country);
|
||||
}
|
||||
else if (tokens.length > 2) {
|
||||
final String language = tokens[0];
|
||||
String language = tokens[0];
|
||||
validateLocalePart(language);
|
||||
final String country = tokens[1];
|
||||
String country = tokens[1];
|
||||
validateLocalePart(country);
|
||||
final String variant = Arrays.stream(tokens).skip(2).collect(Collectors.joining(delimiter));
|
||||
String variant = Arrays.stream(tokens).skip(2).collect(Collectors.joining(delimiter));
|
||||
return new Locale(language, country, variant);
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid locale format: '" + localeString + "'");
|
||||
|
||||
Reference in New Issue
Block a user