Merge "Define QueryCallback as a functional interface" into androidx-main am: a90dc7f247
Original change: https://android-review.googlesource.com/c/platform/frameworks/support/+/2594891
Change-Id: I155cc295c5aa74b8da588c94db6e2cded29e2047
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/QueryInterceptorTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/QueryInterceptorTest.kt
index 4f6a445..82a15d5 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/QueryInterceptorTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/QueryInterceptorTest.kt
@@ -82,12 +82,10 @@
ApplicationProvider.getApplicationContext(),
QueryInterceptorTestDatabase::class.java
).setQueryCallback(
- object : RoomDatabase.QueryCallback {
- override fun onQuery(sqlQuery: String, bindArgs: List<Any?>) {
- val argTrace = ArrayList<Any?>()
- argTrace.addAll(bindArgs)
- queryAndArgs.add(Pair(sqlQuery, argTrace))
- }
+ { sqlQuery, bindArgs ->
+ val argTrace = ArrayList<Any?>()
+ argTrace.addAll(bindArgs)
+ queryAndArgs.add(Pair(sqlQuery, argTrace))
},
MoreExecutors.directExecutor()
).build()
@@ -190,12 +188,10 @@
ApplicationProvider.getApplicationContext(),
QueryInterceptorTestDatabase::class.java
).setQueryCallback(
- object : RoomDatabase.QueryCallback {
- override fun onQuery(sqlQuery: String, bindArgs: List<Any?>) {
- val argTrace = ArrayList<Any?>()
- argTrace.addAll(bindArgs)
- queryAndArgs.add(Pair(sqlQuery, argTrace))
- }
+ { sqlQuery, bindArgs ->
+ val argTrace = ArrayList<Any?>()
+ argTrace.addAll(bindArgs)
+ queryAndArgs.add(Pair(sqlQuery, argTrace))
},
MoreExecutors.directExecutor()
)
diff --git a/room/room-runtime/api/current.txt b/room/room-runtime/api/current.txt
index 85a503e..2b171d7 100644
--- a/room/room-runtime/api/current.txt
+++ b/room/room-runtime/api/current.txt
@@ -146,7 +146,7 @@
method public void onOpenPrepackagedDatabase(androidx.sqlite.db.SupportSQLiteDatabase db);
}
- public static interface RoomDatabase.QueryCallback {
+ public static fun interface RoomDatabase.QueryCallback {
method public void onQuery(String sqlQuery, java.util.List<?> bindArgs);
}
diff --git a/room/room-runtime/api/restricted_current.txt b/room/room-runtime/api/restricted_current.txt
index 3c93dee..0d2b10b 100644
--- a/room/room-runtime/api/restricted_current.txt
+++ b/room/room-runtime/api/restricted_current.txt
@@ -201,7 +201,7 @@
method public void onOpenPrepackagedDatabase(androidx.sqlite.db.SupportSQLiteDatabase db);
}
- public static interface RoomDatabase.QueryCallback {
+ public static fun interface RoomDatabase.QueryCallback {
method public void onQuery(String sqlQuery, java.util.List<?> bindArgs);
}
diff --git a/room/room-runtime/src/main/java/androidx/room/RoomDatabase.kt b/room/room-runtime/src/main/java/androidx/room/RoomDatabase.kt
index 798a2fbc..fd8e753 100644
--- a/room/room-runtime/src/main/java/androidx/room/RoomDatabase.kt
+++ b/room/room-runtime/src/main/java/androidx/room/RoomDatabase.kt
@@ -1532,7 +1532,7 @@
*
* Can be set using [RoomDatabase.Builder.setQueryCallback].
*/
- interface QueryCallback {
+ fun interface QueryCallback {
/**
* Called when a SQL query is executed.
*