aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-04-23 21:35:18 +0200
committerSven Gothel <[email protected]>2022-04-23 21:35:18 +0200
commit733a853e5f7fb085b42699cf9dc800ad45b09e0f (patch)
treefa7996b3f0b82e918be02f78509d06123c4c1273
parent02359c292f0fa3c4dcede52eac05afe94e0deccd (diff)
'Fix' OpenJDK 17 deprecated and removal warnings
-rw-r--r--java/jau/direct_bt/DBTManager.java3
-rw-r--r--java/org/direct_bt/BTFactory.java14
-rw-r--r--java/org/direct_bt/PlatformToolkit.java5
3 files changed, 15 insertions, 7 deletions
diff --git a/java/jau/direct_bt/DBTManager.java b/java/jau/direct_bt/DBTManager.java
index 8badfaff..966ca96b 100644
--- a/java/jau/direct_bt/DBTManager.java
+++ b/java/jau/direct_bt/DBTManager.java
@@ -25,7 +25,6 @@
package jau.direct_bt;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
@@ -48,7 +47,7 @@ public class DBTManager implements BTManager
private static final List<Runnable> userShutdownHooks = new ArrayList<Runnable>();
static {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ BTFactory.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
Runtime.getRuntime().addShutdownHook(
diff --git a/java/org/direct_bt/BTFactory.java b/java/org/direct_bt/BTFactory.java
index 2e7be737..65dbf83a 100644
--- a/java/org/direct_bt/BTFactory.java
+++ b/java/org/direct_bt/BTFactory.java
@@ -29,7 +29,6 @@ import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -157,6 +156,17 @@ public class BTFactory {
*/
public static final boolean JAULIB_JARCACHE_USED;
+ /**
+ * Deprecated call to {@link java.security.AccessController#doPrivileged(PrivilegedAction)} w/o warnings.
+ * @param <T>
+ * @param o
+ * @return
+ */
+ @SuppressWarnings({ "deprecation", "removal" })
+ public static <T> T doPrivileged(final PrivilegedAction<T> o) {
+ return java.security.AccessController.doPrivileged( o );
+ }
+
static {
{
final String v = System.getProperty("org.direct_bt.debug", "false");
@@ -263,7 +273,7 @@ public class BTFactory {
if( DEBUG ) {
System.err.println("BlootoothFactory: Mapping '[org.|jau.]direct_bt.*' properties to native environment");
}
- final Properties props = AccessController.doPrivileged(new PrivilegedAction<Properties>() {
+ final Properties props = doPrivileged(new PrivilegedAction<Properties>() {
@Override
public Properties run() {
return System.getProperties();
diff --git a/java/org/direct_bt/PlatformToolkit.java b/java/org/direct_bt/PlatformToolkit.java
index 480200e3..27a3021b 100644
--- a/java/org/direct_bt/PlatformToolkit.java
+++ b/java/org/direct_bt/PlatformToolkit.java
@@ -29,7 +29,6 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
@@ -253,7 +252,7 @@ final class PlatformToolkit {
static {
{
final String[] props =
- AccessController.doPrivileged(new PrivilegedAction<String[]>() {
+ BTFactory.doPrivileged(new PrivilegedAction<String[]>() {
@Override
public String[] run() {
final String[] props = new String[5];
@@ -450,7 +449,7 @@ final class PlatformToolkit {
return prefix + libBaseName + suffix;
}
private static final String getCanonicalPath(final String path) {
- return AccessController.doPrivileged(new PrivilegedAction<String>() {
+ return BTFactory.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
try {