Make IBpfMap extends AutoCloseable and BpfMap implements IBpfMap
IBpfMap defines all required functions of BpfMap interface.
Ex: close() from AutoCloseable
After:
AutoCloseable ---> IBpfMap ---> BpfMap
Before:
AutoCloseable -+
|
+---> BpfMap
|
IBpfMap -------+
Test: BpfMapTest
Change-Id: I5266d9bfdfcb68f632c13d214705309893dded95
diff --git a/staticlibs/device/com/android/net/module/util/BpfMap.java b/staticlibs/device/com/android/net/module/util/BpfMap.java
index d4ce83b..f1420c2 100644
--- a/staticlibs/device/com/android/net/module/util/BpfMap.java
+++ b/staticlibs/device/com/android/net/module/util/BpfMap.java
@@ -39,7 +39,7 @@
* @param <K> the key of the map.
* @param <V> the value of the map.
*/
-public class BpfMap<K extends Struct, V extends Struct> implements IBpfMap<K, V>, AutoCloseable {
+public class BpfMap<K extends Struct, V extends Struct> implements IBpfMap<K, V> {
static {
System.loadLibrary(JniUtil.getJniLibraryName(BpfMap.class.getPackage()));
}
diff --git a/staticlibs/device/com/android/net/module/util/IBpfMap.java b/staticlibs/device/com/android/net/module/util/IBpfMap.java
index d43b22c..dce369a 100644
--- a/staticlibs/device/com/android/net/module/util/IBpfMap.java
+++ b/staticlibs/device/com/android/net/module/util/IBpfMap.java
@@ -20,7 +20,6 @@
import androidx.annotation.NonNull;
import java.util.NoSuchElementException;
-import java.util.function.BiConsumer;
/**
* The interface of BpfMap. This could be used to inject for testing.
@@ -29,7 +28,7 @@
* @param <K> the key of the map.
* @param <V> the value of the map.
*/
-public interface IBpfMap<K extends Struct, V extends Struct> {
+public interface IBpfMap<K extends Struct, V extends Struct> extends AutoCloseable {
/** Update an existing or create a new key -> value entry in an eBbpf map. */
void updateEntry(K key, V value) throws ErrnoException;