Merge "Flatten FingerprintManagerCompat" into oc-mr1-dev
diff --git a/api/26.1.0-SNAPSHOT.txt b/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from api/26.1.0-SNAPSHOT.txt
rename to api/27.0.0-SNAPSHOT.txt
diff --git a/app-toolkit/common/src/main/java/android/arch/core/internal/SafeIterableMap.java b/app-toolkit/common/src/main/java/android/arch/core/internal/SafeIterableMap.java
index 16a7607..00e102f 100644
--- a/app-toolkit/common/src/main/java/android/arch/core/internal/SafeIterableMap.java
+++ b/app-toolkit/common/src/main/java/android/arch/core/internal/SafeIterableMap.java
@@ -300,18 +300,19 @@
private class IteratorWithAdditions implements Iterator<Map.Entry<K, V>>, SupportRemove<K, V> {
private Entry<K, V> mCurrent;
- private boolean mFirstStep = true;
+ private boolean mBeforeStart = true;
@Override
public void supportRemove(@NonNull Entry<K, V> entry) {
if (entry == mCurrent) {
mCurrent = mCurrent.mPrevious;
+ mBeforeStart = mCurrent == null;
}
}
@Override
public boolean hasNext() {
- if (mFirstStep) {
+ if (mBeforeStart) {
return mStart != null;
}
return mCurrent != null && mCurrent.mNext != null;
@@ -319,8 +320,8 @@
@Override
public Map.Entry<K, V> next() {
- if (mFirstStep) {
- mFirstStep = false;
+ if (mBeforeStart) {
+ mBeforeStart = false;
mCurrent = mStart;
} else {
mCurrent = mCurrent != null ? mCurrent.mNext : null;
diff --git a/app-toolkit/common/src/test/java/android/arch/core/internal/SafeIterableMapTest.java b/app-toolkit/common/src/test/java/android/arch/core/internal/SafeIterableMapTest.java
index 4b25e34..d879543 100644
--- a/app-toolkit/common/src/test/java/android/arch/core/internal/SafeIterableMapTest.java
+++ b/app-toolkit/common/src/test/java/android/arch/core/internal/SafeIterableMapTest.java
@@ -200,6 +200,20 @@
}
@Test
+ public void testRemoveDuringIteration4() {
+ SafeIterableMap<Integer, Boolean> map = mapOf(1, 2);
+ int[] expected = new int[]{1, 2};
+ int index = 0;
+ for (Entry<Integer, Boolean> entry : map) {
+ assertThat(entry.getKey(), is(expected[index++]));
+ if (index == 1) {
+ map.remove(1);
+ }
+ }
+ assertThat(index, is(2));
+ }
+
+ @Test
public void testAdditionDuringIteration() {
SafeIterableMap<Integer, Boolean> map = mapOf(1, 2, 3, 4);
int[] expected = new int[]{1, 2, 3, 4};
@@ -317,6 +331,22 @@
}
@Test
+ public void testIteratorWithAddition5() {
+ SafeIterableMap<Integer, Boolean> map = mapOf(1, 2);
+ int[] expected = new int[]{1, 2};
+ int index = 0;
+ Iterator<Entry<Integer, Boolean>> iterator = map.iteratorWithAdditions();
+ while (iterator.hasNext()) {
+ Entry<Integer, Boolean> entry = iterator.next();
+ assertThat(entry.getKey(), is(expected[index++]));
+ if (index == 1) {
+ map.remove(1);
+ }
+ }
+ assertThat(index, is(2));
+ }
+
+ @Test
public void testDescendingIteration() {
SafeIterableMap<Integer, Boolean> map = mapOf(1, 2, 3, 4);
int[] expected = new int[]{4, 3, 2, 1};
diff --git a/buildSrc/init.gradle b/buildSrc/init.gradle
index b9f85d3..014e3dc 100644
--- a/buildSrc/init.gradle
+++ b/buildSrc/init.gradle
@@ -300,6 +300,12 @@
// e.g. palette-v7-debug-androidTest.apk becomes
// support-palette-v7_palette-v7-debug-androidTest.apk
"${project.getPath().replace(':', '-').substring(1)}_${fileName}"
+
+ // Exclude media-compat-test-* modules from existing support library
+ // presubmit tests.
+ if (fileName.contains("media-compat-test")) {
+ fileName.replace("-debug-androidTest", "")
+ }
}
}
}
diff --git a/buildSrc/src/main/java/android/support/LibraryVersions.java b/buildSrc/src/main/java/android/support/LibraryVersions.java
index 6b15a48..a99363e 100644
--- a/buildSrc/src/main/java/android/support/LibraryVersions.java
+++ b/buildSrc/src/main/java/android/support/LibraryVersions.java
@@ -23,7 +23,7 @@
/**
* Version code of the support library components.
*/
- public static final Version SUPPORT_LIBRARY = new Version("26.1.0-SNAPSHOT");
+ public static final Version SUPPORT_LIBRARY = new Version("27.0.0-SNAPSHOT");
/**
* Version code of the flatfoot libraries.
diff --git a/compat/api/26.1.0-SNAPSHOT.txt b/compat/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from compat/api/26.1.0-SNAPSHOT.txt
rename to compat/api/27.0.0-SNAPSHOT.txt
diff --git a/content/api/26.1.0-SNAPSHOT.txt b/content/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from content/api/26.1.0-SNAPSHOT.txt
rename to content/api/27.0.0-SNAPSHOT.txt
diff --git a/core-ui/api/26.1.0-SNAPSHOT.txt b/core-ui/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from core-ui/api/26.1.0-SNAPSHOT.txt
rename to core-ui/api/27.0.0-SNAPSHOT.txt
diff --git a/core-utils/api/26.1.0-SNAPSHOT.txt b/core-utils/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from core-utils/api/26.1.0-SNAPSHOT.txt
rename to core-utils/api/27.0.0-SNAPSHOT.txt
diff --git a/customtabs/api/26.1.0-SNAPSHOT.txt b/customtabs/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from customtabs/api/26.1.0-SNAPSHOT.txt
rename to customtabs/api/27.0.0-SNAPSHOT.txt
diff --git a/design/api/26.1.0-SNAPSHOT.txt b/design/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from design/api/26.1.0-SNAPSHOT.txt
rename to design/api/27.0.0-SNAPSHOT.txt
diff --git a/dynamic-animation/api/26.1.0-SNAPSHOT.txt b/dynamic-animation/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from dynamic-animation/api/26.1.0-SNAPSHOT.txt
rename to dynamic-animation/api/27.0.0-SNAPSHOT.txt
diff --git a/emoji/appcompat/api/26.1.0-SNAPSHOT.txt b/emoji/appcompat/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from emoji/appcompat/api/26.1.0-SNAPSHOT.txt
rename to emoji/appcompat/api/27.0.0-SNAPSHOT.txt
diff --git a/emoji/bundled/api/26.1.0-SNAPSHOT.txt b/emoji/bundled/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from emoji/bundled/api/26.1.0-SNAPSHOT.txt
rename to emoji/bundled/api/27.0.0-SNAPSHOT.txt
diff --git a/emoji/core/api/26.1.0-SNAPSHOT.txt b/emoji/core/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from emoji/core/api/26.1.0-SNAPSHOT.txt
rename to emoji/core/api/27.0.0-SNAPSHOT.txt
diff --git a/exifinterface/api/26.1.0-SNAPSHOT.txt b/exifinterface/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from exifinterface/api/26.1.0-SNAPSHOT.txt
rename to exifinterface/api/27.0.0-SNAPSHOT.txt
diff --git a/fragment/api/26.1.0-SNAPSHOT.txt b/fragment/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from fragment/api/26.1.0-SNAPSHOT.txt
rename to fragment/api/27.0.0-SNAPSHOT.txt
diff --git a/graphics/drawable/animated/api/26.1.0-SNAPSHOT.txt b/graphics/drawable/animated/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from graphics/drawable/animated/api/26.1.0-SNAPSHOT.txt
rename to graphics/drawable/animated/api/27.0.0-SNAPSHOT.txt
diff --git a/graphics/drawable/static/api/26.1.0-SNAPSHOT.txt b/graphics/drawable/static/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from graphics/drawable/static/api/26.1.0-SNAPSHOT.txt
rename to graphics/drawable/static/api/27.0.0-SNAPSHOT.txt
diff --git a/lifecycle/extensions/src/main/java/android/arch/lifecycle/LiveData.java b/lifecycle/extensions/src/main/java/android/arch/lifecycle/LiveData.java
index d689442..99d859c 100644
--- a/lifecycle/extensions/src/main/java/android/arch/lifecycle/LiveData.java
+++ b/lifecycle/extensions/src/main/java/android/arch/lifecycle/LiveData.java
@@ -87,7 +87,7 @@
// how many observers are in active state
private int mActiveCount = 0;
- private Object mData = NOT_SET;
+ private volatile Object mData = NOT_SET;
// when setData is called, we set the pending data and actual data swap happens on the main
// thread
private volatile Object mPendingData = NOT_SET;
@@ -302,12 +302,10 @@
*/
@Nullable
public T getValue() {
- // we do not return pending data here to be able to serve a consistent view to the main
- // thread.
Object data = mData;
- if (mData != NOT_SET) {
+ if (data != NOT_SET) {
//noinspection unchecked
- return (T) mData;
+ return (T) data;
}
return null;
}
diff --git a/lifecycle/extensions/src/test/java/android/arch/lifecycle/LiveDataTest.java b/lifecycle/extensions/src/test/java/android/arch/lifecycle/LiveDataTest.java
index f401e1c..1802d94 100644
--- a/lifecycle/extensions/src/test/java/android/arch/lifecycle/LiveDataTest.java
+++ b/lifecycle/extensions/src/test/java/android/arch/lifecycle/LiveDataTest.java
@@ -368,6 +368,22 @@
}
@Test
+ public void testRemoveDuringSetValue() {
+ mRegistry.handleLifecycleEvent(ON_START);
+ final Observer observer1 = spy(new Observer<String>() {
+ @Override
+ public void onChanged(String o) {
+ mLiveData.removeObserver(this);
+ }
+ });
+ Observer<String> observer2 = (Observer<String>) mock(Observer.class);
+ mLiveData.observeForever(observer1);
+ mLiveData.observe(mOwner, observer2);
+ mLiveData.setValue("gt");
+ verify(observer2).onChanged("gt");
+ }
+
+ @Test
public void testDataChangeDuringStateChange() {
mRegistry.handleLifecycleEvent(ON_START);
mRegistry.addObserver(new LifecycleObserver() {
diff --git a/media-compat-test-client/tests/src/android/support/mediacompat/client/MediaBrowserCompatTest.java b/media-compat-test-client/tests/src/android/support/mediacompat/client/MediaBrowserCompatTest.java
new file mode 100644
index 0000000..8c20794
--- /dev/null
+++ b/media-compat-test-client/tests/src/android/support/mediacompat/client/MediaBrowserCompatTest.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.support.mediacompat.client;
+
+import static android.support.mediacompat.testlib.MediaBrowserConstants.EXTRAS_KEY;
+import static android.support.mediacompat.testlib.MediaBrowserConstants.EXTRAS_VALUE;
+import static android.support.mediacompat.testlib.MediaBrowserConstants.MEDIA_ID_ROOT;
+import static android.support.test.InstrumentationRegistry.getInstrumentation;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.fail;
+
+import android.content.ComponentName;
+import android.os.Bundle;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.support.testutils.PollingCheck;
+import android.support.v4.media.MediaBrowserCompat;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test {@link android.support.v4.media.MediaBrowserCompat}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class MediaBrowserCompatTest {
+ static final ComponentName TEST_BROWSER_SERVICE = new ComponentName(
+ "android.support.mediacompat.service.test",
+ "android.support.mediacompat.service.StubMediaBrowserServiceCompat");
+
+ // The maximum time to wait for an operation.
+ private static final long TIME_OUT_MS = 3000L;
+
+ private MediaBrowserCompat mMediaBrowser;
+ private StubConnectionCallback mConnectionCallback;
+ private Bundle mRootHints;
+
+ @Before
+ public void setUp() {
+ mConnectionCallback = new StubConnectionCallback();
+ mRootHints = new Bundle();
+
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ mMediaBrowser = new MediaBrowserCompat(getInstrumentation().getTargetContext(),
+ TEST_BROWSER_SERVICE, mConnectionCallback, mRootHints);
+ }
+ });
+ }
+
+ @After
+ public void tearDown() {
+ if (mMediaBrowser != null && mMediaBrowser.isConnected()) {
+ mMediaBrowser.disconnect();
+ }
+ }
+
+ @Test
+ @SmallTest
+ public void testConnectAndDisconnect() throws Exception {
+ assertFalse(mMediaBrowser.isConnected());
+ connectToMediaBrowserService();
+
+ assertEquals(1, mConnectionCallback.mConnectedCount);
+ assertEquals(TEST_BROWSER_SERVICE, mMediaBrowser.getServiceComponent());
+ assertEquals(MEDIA_ID_ROOT, mMediaBrowser.getRoot());
+ assertEquals(EXTRAS_VALUE, mMediaBrowser.getExtras().getString(EXTRAS_KEY));
+
+ mMediaBrowser.disconnect();
+ new PollingCheck(TIME_OUT_MS) {
+ @Override
+ protected boolean check() {
+ return !mMediaBrowser.isConnected();
+ }
+ }.run();
+ }
+
+ private void connectToMediaBrowserService() throws Exception {
+ synchronized (mConnectionCallback.mWaitLock) {
+ mMediaBrowser.connect();
+ mConnectionCallback.mWaitLock.wait(TIME_OUT_MS);
+ if (!mMediaBrowser.isConnected()) {
+ fail("Browser failed to connect!");
+ }
+ }
+ }
+
+ private class StubConnectionCallback extends MediaBrowserCompat.ConnectionCallback {
+ Object mWaitLock = new Object();
+ volatile int mConnectedCount;
+
+ @Override
+ public void onConnected() {
+ synchronized (mWaitLock) {
+ mConnectedCount++;
+ mWaitLock.notify();
+ }
+ }
+ }
+}
diff --git a/media-compat-test-service/build.gradle b/media-compat-test-service/build.gradle
index 6d54c89..c959ac0 100644
--- a/media-compat-test-service/build.gradle
+++ b/media-compat-test-service/build.gradle
@@ -16,9 +16,13 @@
apply plugin: android.support.SupportLibraryPlugin
dependencies {
- api project(':support-annotations')
- api project(':support-media-compat')
- api project(':support-media-compat-test-lib')
+ androidTestImplementation project(':support-annotations')
+ androidTestImplementation project(':support-media-compat')
+ androidTestImplementation project(':support-media-compat-test-lib')
+
+ androidTestImplementation(libs.test_runner) {
+ exclude module: 'support-annotations'
+ }
}
android {
diff --git a/media-compat/api/26.1.0-SNAPSHOT.txt b/media-compat/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from media-compat/api/26.1.0-SNAPSHOT.txt
rename to media-compat/api/27.0.0-SNAPSHOT.txt
diff --git a/percent/api/26.1.0-SNAPSHOT.txt b/percent/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from percent/api/26.1.0-SNAPSHOT.txt
rename to percent/api/27.0.0-SNAPSHOT.txt
diff --git a/recommendation/api/26.1.0-SNAPSHOT.txt b/recommendation/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from recommendation/api/26.1.0-SNAPSHOT.txt
rename to recommendation/api/27.0.0-SNAPSHOT.txt
diff --git a/room/compiler/src/main/kotlin/android/arch/persistence/room/RoomProcessor.kt b/room/compiler/src/main/kotlin/android/arch/persistence/room/RoomProcessor.kt
index 78849eb..3b11efd 100644
--- a/room/compiler/src/main/kotlin/android/arch/persistence/room/RoomProcessor.kt
+++ b/room/compiler/src/main/kotlin/android/arch/persistence/room/RoomProcessor.kt
@@ -55,7 +55,7 @@
}
val allDaoMethods = databases?.flatMap { it.daoMethods }
allDaoMethods?.let {
- prepareDaosForWriting(databases!!, it)
+ prepareDaosForWriting(databases, it)
it.forEach {
DaoWriter(it.dao, context.processingEnv).write(context.processingEnv)
}
@@ -81,9 +81,7 @@
}
}
}
- context.databaseVerifier?.let {
- it.closeConnection()
- }
+ context.databaseVerifier?.closeConnection()
return mutableSetOf()
}
override fun annotations(): MutableSet<out Class<out Annotation>> {
@@ -104,9 +102,7 @@
// first suffix guess: Database's simple name
val db = databases.first { db -> db.daoMethods.contains(daoMethod) }
db.typeName.simpleName()
- }.forEach { entry ->
- val dbName = entry.key
- val methods = entry.value
+ }.forEach { (dbName, methods) ->
if (methods.size == 1) {
//good, db names do not clash, use db name as suffix
methods.first().dao.setSuffix(dbName)
diff --git a/room/compiler/src/main/kotlin/android/arch/persistence/room/parser/ParsedQuery.kt b/room/compiler/src/main/kotlin/android/arch/persistence/room/parser/ParsedQuery.kt
index 85d578d..fcf2e08 100644
--- a/room/compiler/src/main/kotlin/android/arch/persistence/room/parser/ParsedQuery.kt
+++ b/room/compiler/src/main/kotlin/android/arch/persistence/room/parser/ParsedQuery.kt
@@ -118,7 +118,6 @@
TEXT -> it.text
BIND_VAR -> "?"
NEWLINE -> "\n"
- else -> throw IllegalArgumentException("??")
}
}
}
diff --git a/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/DaoWriter.kt b/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/DaoWriter.kt
index 29a6ba7..a800966 100644
--- a/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/DaoWriter.kt
+++ b/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/DaoWriter.kt
@@ -270,7 +270,7 @@
* Creates EntityUpdateAdapter for each deletion method.
*/
private fun createDeletionMethods(): List<PreparedStmtQuery> {
- return createShortcutMethods(dao.deletionMethods, "deletion", { deletionMethod, entity ->
+ return createShortcutMethods(dao.deletionMethods, "deletion", { _, entity ->
EntityDeletionAdapterWriter(entity)
.createAnonymous(this@DaoWriter, dbField.name)
})
diff --git a/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/TableInfoValidationWriter.kt b/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/TableInfoValidationWriter.kt
index e27600a..fe9e743 100644
--- a/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/TableInfoValidationWriter.kt
+++ b/room/compiler/src/main/kotlin/android/arch/persistence/room/writer/TableInfoValidationWriter.kt
@@ -44,7 +44,7 @@
addStatement("final $T $L = new $T($L)", columnListType, columnListVar,
columnListType, entity.fields.size)
- entity.fields.forEachIndexed { index, field ->
+ entity.fields.forEach { field ->
addStatement("$L.put($S, new $T($S, $S, $L, $L))",
columnListVar, field.columnName, RoomTypeNames.TABLE_INFO_COLUMN,
/*name*/ field.columnName,
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/CustomConverterProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/CustomConverterProcessorTest.kt
index 34bbd24..6b8dbaf 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/CustomConverterProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/CustomConverterProcessorTest.kt
@@ -61,7 +61,7 @@
@Test
fun validCase() {
singleClass(createConverter(TypeName.SHORT.box(), TypeName.CHAR.box()))
- { converter, invocation ->
+ { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.SHORT.box()))
assertThat(converter?.toTypeName, `is`(TypeName.CHAR.box()))
}.compilesWithoutError()
@@ -69,7 +69,7 @@
@Test
fun primitiveFrom() {
- singleClass(createConverter(TypeName.SHORT, TypeName.CHAR.box())) { converter, invocation ->
+ singleClass(createConverter(TypeName.SHORT, TypeName.CHAR.box())) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.SHORT))
assertThat(converter?.toTypeName, `is`(TypeName.CHAR.box()))
}.compilesWithoutError()
@@ -77,7 +77,7 @@
@Test
fun primitiveTo() {
- singleClass(createConverter(TypeName.INT.box(), TypeName.DOUBLE)) { converter, invocation ->
+ singleClass(createConverter(TypeName.INT.box(), TypeName.DOUBLE)) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.INT.box()))
assertThat(converter?.toTypeName, `is`(TypeName.DOUBLE))
}.compilesWithoutError()
@@ -85,7 +85,7 @@
@Test
fun primitiveBoth() {
- singleClass(createConverter(TypeName.INT, TypeName.DOUBLE)) { converter, invocation ->
+ singleClass(createConverter(TypeName.INT, TypeName.DOUBLE)) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.INT))
assertThat(converter?.toTypeName, `is`(TypeName.DOUBLE))
}.compilesWithoutError()
@@ -95,7 +95,7 @@
fun nonNullButNotBoxed() {
val string = String::class.typeName()
val date = Date::class.typeName()
- singleClass(createConverter(string, date)) { converter, invocation ->
+ singleClass(createConverter(string, date)) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(string as TypeName))
assertThat(converter?.toTypeName, `is`(date as TypeName))
}
@@ -108,7 +108,7 @@
val typeVarK = TypeVariableName.get("K")
val map = ParameterizedTypeName.get(Map::class.typeName(), typeVarK, typeVarT)
singleClass(createConverter(list, map, listOf(typeVarK, typeVarT))) {
- converter, invocation ->
+ _, _ ->
}.failsToCompile().withErrorContaining(TYPE_CONVERTER_UNBOUND_GENERIC)
}
@@ -118,7 +118,7 @@
val date = Date::class.typeName()
val list = ParameterizedTypeName.get(List::class.typeName(), string)
val map = ParameterizedTypeName.get(Map::class.typeName(), string, date)
- singleClass(createConverter(list, map)) { converter, invocation ->
+ singleClass(createConverter(list, map)) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(list as TypeName))
assertThat(converter?.toTypeName, `is`(map as TypeName))
}.compilesWithoutError()
@@ -131,7 +131,7 @@
package ${CONVERTER.packageName()};
public class ${CONVERTER.simpleName()} {
}
- """)) { converter, invocation ->
+ """)) { _, _ ->
}.failsToCompile().withErrorContaining(TYPE_CONVERTER_EMPTY_CLASS)
}
@@ -147,7 +147,7 @@
@TypeConverter
public int x(short y) {return 0;}
}
- """)) { converter, invocation ->
+ """)) { _, _ ->
}.failsToCompile().withErrorContaining(TYPE_CONVERTER_MISSING_NOARG_CONSTRUCTOR)
}
@@ -163,7 +163,7 @@
@TypeConverter
public static int x(short y) {return 0;}
}
- """)) { converter, invocation ->
+ """)) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.SHORT))
assertThat(converter?.toTypeName, `is`(TypeName.INT))
assertThat(converter?.isStatic, `is`(true))
@@ -181,7 +181,7 @@
@TypeConverter static int x(short y) {return 0;}
@TypeConverter private static int y(boolean y) {return 0;}
}
- """)) { converter, invocation ->
+ """)) { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.SHORT))
assertThat(converter?.toTypeName, `is`(TypeName.INT))
assertThat(converter?.isStatic, `is`(true))
@@ -223,7 +223,7 @@
@Test
fun checkDuplicates() {
singleClass(createConverter(TypeName.SHORT.box(), TypeName.CHAR.box(), duplicate = true))
- { converter, invocation ->
+ { converter, _ ->
assertThat(converter?.fromTypeName, `is`(TypeName.SHORT.box()))
assertThat(converter?.toTypeName, `is`(TypeName.CHAR.box()))
}.failsToCompile().withErrorContaining("Multiple methods define the same conversion")
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DaoProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DaoProcessorTest.kt
index a53cc1e..3ade277 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DaoProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DaoProcessorTest.kt
@@ -49,7 +49,7 @@
@Test
fun testNonAbstract() {
- singleDao("@Dao public class MyDao {}") { dao, invocation -> }
+ singleDao("@Dao public class MyDao {}") { _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.DAO_MUST_BE_AN_ABSTRACT_CLASS_OR_AN_INTERFACE)
}
@@ -60,7 +60,7 @@
@Dao public interface MyDao {
int getFoo();
}
- """) { dao, invocation ->
+ """) { _, _ ->
}.failsToCompile()
.withErrorContaining(ProcessorErrors.ABSTRACT_METHOD_IN_DAO_MISSING_ANY_ANNOTATION)
}
@@ -73,7 +73,7 @@
@Insert
int getFoo(int x);
}
- """) { dao, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.CANNOT_USE_MORE_THAN_ONE_DAO_METHOD_ANNOTATION)
}
@@ -85,7 +85,7 @@
@Query("SELECT uid FROM User")
abstract int[] getIds();
}
- """) { dao, invocation ->
+ """) { dao, _ ->
assertThat(dao.queryMethods.size, `is`(1))
val method = dao.queryMethods.first()
assertThat(method.name, `is`("getIds"))
@@ -99,7 +99,7 @@
@Query("SELECT uid FROM User")
abstract int[] getIds();
}
- """) { dao, invocation ->
+ """) { dao, _ ->
assertThat(dao.queryMethods.size, `is`(1))
val method = dao.queryMethods.first()
assertThat(method.name, `is`("getIds"))
@@ -115,7 +115,7 @@
@Insert
abstract void insert(User user);
}
- """) { dao, invocation ->
+ """) { dao, _ ->
assertThat(dao.queryMethods.size, `is`(1))
val method = dao.queryMethods.first()
assertThat(method.name, `is`("getIds"))
@@ -132,7 +132,7 @@
@Query("SELECT nonExistingField FROM User")
abstract int[] getIds();
}
- """) { dao, invocation ->
+ """) { dao, _ ->
assertThat(dao.queryMethods.size, `is`(1))
val method = dao.queryMethods.first()
assertThat(method.name, `is`("getIds"))
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DatabaseProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DatabaseProcessorTest.kt
index 56e6641..40e9a96 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DatabaseProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/DatabaseProcessorTest.kt
@@ -151,7 +151,7 @@
public abstract class MyDb extends RoomDatabase {
abstract UserDao userDao();
}
- """, USER, USER_DAO) { db, invocation ->
+ """, USER, USER_DAO) { db, _ ->
assertThat(db.daoMethods.size, `is`(1))
assertThat(db.entities.size, `is`(1))
}.compilesWithoutError()
@@ -165,7 +165,7 @@
abstract UserDao userDao();
abstract BookDao bookDao();
}
- """, USER, USER_DAO, BOOK, BOOK_DAO) { db, invocation ->
+ """, USER, USER_DAO, BOOK, BOOK_DAO) { db, _ ->
assertThat(db.daoMethods.size, `is`(2))
assertThat(db.entities.size, `is`(2))
assertThat(db.daoMethods.map { it.name }, `is`(listOf("userDao", "bookDao")))
@@ -180,7 +180,7 @@
@Database(entities = {User.class, Book.class}, version = 42)
public abstract class MyDb {
}
- """, USER, BOOK) { db, invocation ->
+ """, USER, BOOK) { _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.DB_MUST_EXTEND_ROOM_DB)
}
@@ -201,7 +201,7 @@
@Query("SELECT * FROM nonExistentTable")
public java.util.List<Book> loadAllBooks();
}
- """)){ db, invocation ->
+ """)){ _, _ ->
}.failsToCompile().withErrorContaining("no such table: nonExistentTable")
}
@@ -222,7 +222,7 @@
@PrimaryKey
int uid;
}
- """)) { db, invocation ->
+ """)) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.duplicateTableNames("user",
listOf("foo.bar.User", "foo.bar.AnotherClass"))
@@ -247,7 +247,7 @@
@Query("SELECT nonExistingField FROM Book")
public java.util.List<Book> loadAllBooks();
}
- """)){ db, invocation ->
+ """)){ _, _ ->
}.compilesWithoutError()
}
@@ -294,7 +294,7 @@
abstract UserDao userDao();
abstract UserDao userDao2();
}
- """, USER, USER_DAO){db, invocation -> }
+ """, USER, USER_DAO){ _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.DAO_METHOD_CONFLICTS_WITH_OTHERS)
.and()
@@ -347,7 +347,7 @@
@Database(entities = {Entity1.class, Entity2.class}, version = 42)
public abstract class MyDb extends RoomDatabase {
}
- """, entity1, entity2){ db, invocation ->
+ """, entity1, entity2){ _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.duplicateIndexInDatabase("index_name",
@@ -374,7 +374,7 @@
@Database(entities = {Entity1.class}, version = 42)
public abstract class MyDb extends RoomDatabase {
}
- """, entity1, COMMON.USER){ db, invocation ->
+ """, entity1, COMMON.USER){ _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.foreignKeyMissingParentEntityInDatabase("User", "foo.bar.Entity1")
@@ -400,7 +400,7 @@
@Database(entities = {Entity1.class, User.class}, version = 42)
public abstract class MyDb extends RoomDatabase {
}
- """, entity1, COMMON.USER){ db, invocation ->
+ """, entity1, COMMON.USER){ _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.foreignKeyMissingIndexInParent(
@@ -444,7 +444,7 @@
@Database(entities = {Entity1.class, Entity2.class}, version = 42)
public abstract class MyDb extends RoomDatabase {
}
- """, entity1, entity2){ db, invocation ->
+ """, entity1, entity2){ _, _ ->
}.compilesWithoutError()
}
@@ -481,7 +481,7 @@
@Database(entities = {Entity1.class, Entity2.class}, version = 42)
public abstract class MyDb extends RoomDatabase {
}
- """, entity1, entity2){ db, invocation ->
+ """, entity1, entity2){ _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.foreignKeyParentColumnDoesNotExist("foo.bar.Entity2",
"anotherName2", listOf("uid", "anotherName"))
@@ -521,7 +521,7 @@
@Database(entities = {Entity1.class, Entity2.class}, version = 42)
public abstract class MyDb extends RoomDatabase {
}
- """, entity1, entity2){ db, invocation ->
+ """, entity1, entity2){ _, _ ->
}.compilesWithoutError()
}
@@ -532,7 +532,7 @@
public abstract class MyDb extends RoomDatabase {
abstract BookDao bookDao();
}
- """, USER, USER_DAO, BOOK, BOOK_DAO){ db, invocation ->
+ """, USER, USER_DAO, BOOK, BOOK_DAO){ _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.shortcutEntityIsNotInDatabase(
database = "foo.bar.MyDb",
@@ -566,7 +566,7 @@
public static java.util.Date foo(Long input) {return null;}
}
}
- """, USER, USER_DAO){ db, invocation ->
+ """, USER, USER_DAO){ db, _ ->
val userDao = db.daoMethods.first().dao
val insertionMethod = userDao.insertionMethods.find { it.name == "insert" }
assertThat(insertionMethod, notNullValue())
@@ -597,7 +597,7 @@
public abstract class MyDb extends RoomDatabase {
public abstract UserDao userDao();
}
- """, USER, USER_DAO){ db, invocation ->
+ """, USER, USER_DAO){ db, _ ->
val userDao = db.daoMethods.first().dao
val loadOne = userDao.queryMethods.find { it.name == "loadOnePojo" }
assertThat(loadOne, notNullValue())
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/EntityProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/EntityProcessorTest.kt
index 34c522e..2238eb2 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/EntityProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/EntityProcessorTest.kt
@@ -65,7 +65,7 @@
@PrimaryKey
private int id;
public void setId(int id) {this.id = id;}
- """) { entity, invocation -> }
+ """) { _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.CANNOT_FIND_GETTER_FOR_FIELD)
}
@@ -77,7 +77,7 @@
private int id;
public float getId() {return 0f;}
public void setId(int id) {this.id = id;}
- """) { entity, invocation -> }
+ """) { _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.CANNOT_FIND_GETTER_FOR_FIELD)
}
@@ -89,7 +89,7 @@
private int id;
public int getId() {return id;}
public void setId(float id) {}
- """) { entity, invocation -> }
+ """) { _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.CANNOT_FIND_SETTER_FOR_FIELD)
}
@@ -101,7 +101,7 @@
private int id;
public int getId() {return id;}
public void setId(Integer id) {}
- """) { entity, invocation -> }
+ """) { _, _ -> }
.compilesWithoutError()
}
@@ -112,7 +112,7 @@
private int id;
public Integer getId() {return id;}
public void setId(int id) {}
- """) { entity, invocation -> }
+ """) { _, _ -> }
.compilesWithoutError()
}
@@ -122,7 +122,7 @@
@PrimaryKey
private int id;
public int getId(){ return id; }
- """) { entity, invocation -> }
+ """) { _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.CANNOT_FIND_SETTER_FOR_FIELD)
}
@@ -135,7 +135,7 @@
public void setId(int id) {}
public int getId(){ return id; }
public int id(){ return id; }
- """) { entity, invocation -> }
+ """) { _, _ -> }
.failsToCompile()
.withErrorContaining("getId, id")
}
@@ -148,7 +148,7 @@
public void setId(int id) {}
public int getId(){ return id; }
@Ignore public int id(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().getter.name, `is`("getId"))
}.compilesWithoutError()
}
@@ -161,7 +161,7 @@
public void setId(int id) {}
public int getId(){ return id; }
protected int id(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().getter.name, `is`("getId"))
}.compilesWithoutError()
}
@@ -173,7 +173,7 @@
public int id;
public void setId(int id) {}
public int getId(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().getter.name, `is`("id"))
assertThat(entity.fields.first().getter.callType, `is`(CallType.FIELD))
}.compilesWithoutError()
@@ -187,7 +187,7 @@
public void setId(int id) {}
public void id(int id) {}
public int getId(){ return id; }
- """) { entity, invocation -> }
+ """) { _, _ -> }
.failsToCompile()
.withErrorContaining("setId, id")
}
@@ -200,7 +200,7 @@
public void setId(int id) {}
@Ignore public void id(int id) {}
public int getId(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().setter.name, `is`("setId"))
}.compilesWithoutError()
}
@@ -213,7 +213,7 @@
public void setId(int id) {}
protected void id(int id) {}
public int getId(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().setter.name, `is`("setId"))
}.compilesWithoutError()
}
@@ -225,7 +225,7 @@
public int id;
public void setId(int id) {}
public int getId(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().setter.name, `is`("id"))
assertThat(entity.fields.first().setter.callType, `is`(CallType.FIELD))
}.compilesWithoutError()
@@ -238,7 +238,7 @@
int id;
public void setId(int id) {}
public int getId(){ return id; }
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.fields.first().setter.name, `is`("setId"))
assertThat(entity.fields.first().getter.name, `is`("getId"))
}.compilesWithoutError()
@@ -249,7 +249,7 @@
singleEntity("""
@PrimaryKey
int x;
- """, hashMapOf(Pair("tableName", "\"foo_table\""))) { entity, invocation ->
+ """, hashMapOf(Pair("tableName", "\"foo_table\""))) { entity, _ ->
assertThat(entity.tableName, `is`("foo_table"))
}.compilesWithoutError()
}
@@ -259,14 +259,14 @@
singleEntity("""
@PrimaryKey
int x;
- """, hashMapOf(Pair("tableName", "\" \""))) { entity, invocation ->
+ """, hashMapOf(Pair("tableName", "\" \""))) { _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.ENTITY_TABLE_NAME_CANNOT_BE_EMPTY)
}
@Test
fun missingPrimaryKey() {
singleEntity("""
- """) { entity, invocation ->
+ """) { _, _ ->
}.failsToCompile()
.withErrorContaining(ProcessorErrors.MISSING_PRIMARY_KEY)
}
@@ -276,7 +276,7 @@
singleEntity("""
@PrimaryKey
public java.util.Date myDate;
- """) { entity, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.CANNOT_FIND_COLUMN_TYPE_ADAPTER)
}
@@ -295,7 +295,7 @@
int y;
}
"""
- ) { entity, invocation ->
+ ) { entity, _ ->
assertThat(entity.primaryKey.fields.map { it.name }, `is`(listOf("id")))
}.compilesWithoutError()
.withWarningCount(1)
@@ -318,7 +318,7 @@
int y;
}
"""
- ) { entity, invocation ->
+ ) { entity, _ ->
assertThat(entity.primaryKey.fields.map { it.name }, `is`(listOf("id")))
}.compilesWithoutError().withWarningCount(0)
}
@@ -355,7 +355,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "index_MyEntity_foo",
unique = false,
@@ -371,7 +371,7 @@
public int id;
@ColumnInfo(index = true)
public String foo;
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "index_MyEntity_foo",
unique = false,
@@ -391,7 +391,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "index_MyEntity_foo_id",
unique = false,
@@ -413,7 +413,7 @@
@ColumnInfo(name = "bar_column")
public String bar;
"""
- , annotation) { entity, invocation ->
+ , annotation) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "index_MyEntity_foo_id",
unique = false,
@@ -436,7 +436,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "index_MyEntity_foo_id",
unique = true,
@@ -456,7 +456,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "myName",
unique = false,
@@ -477,7 +477,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { entity, _ ->
assertThat(entity.indices, `is`(
listOf(Index(name = "index_MyTable_foo",
unique = false,
@@ -497,7 +497,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.INDEX_COLUMNS_CANNOT_BE_EMPTY
)
@@ -514,7 +514,7 @@
public int id;
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.indexColumnDoesNotExist("bar", listOf("id, foo"))
)
@@ -532,7 +532,7 @@
@ColumnInfo(index = true)
public String foo;
"""
- , annotation) { entity, invocation ->
+ , annotation) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.duplicateIndexInEntity("index_MyEntity_foo")
)
@@ -556,7 +556,7 @@
"""
@PrimaryKey
public int id;
- """, baseClass = "foo.bar.Base", jfos = listOf(parent)) { entity, invocation ->
+ """, baseClass = "foo.bar.Base", jfos = listOf(parent)) { entity, _ ->
assertThat(entity.indices.isEmpty(), `is`(true))
}.compilesWithoutError()
.withWarningContaining(
@@ -597,7 +597,7 @@
baseClass = "foo.bar.Parent",
attributes = hashMapOf("inheritSuperIndices" to "true"),
jfos = listOf(parent, grandParent)) {
- entity, invocation ->
+ entity, _ ->
assertThat(entity.indices.size, `is`(1))
assertThat(entity.indices.first(),
`is`(Index(name = "index_MyEntity_name_lastName",
@@ -626,7 +626,7 @@
""",
baseClass = "foo.bar.Base",
attributes = hashMapOf("inheritSuperIndices" to "true"),
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.indices.size, `is`(1))
assertThat(entity.indices.first(),
`is`(Index(name = "index_MyEntity_name_lastName",
@@ -656,7 +656,7 @@
""",
baseClass = "foo.bar.Base",
attributes = hashMapOf("inheritSuperIndices" to "true"),
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.indices.size, `is`(1))
assertThat(entity.indices.first(),
`is`(Index(name = "index_MyEntity_name",
@@ -693,7 +693,7 @@
@PrimaryKey
public int id;
""", baseClass = "foo.bar.Parent", jfos = listOf(parent, grandParent)) {
- entity, invocation ->
+ entity, _ ->
assertThat(entity.indices.isEmpty(), `is`(true))
}.compilesWithoutError()
.withWarningContaining(
@@ -720,7 +720,7 @@
"""
@PrimaryKey
public int id;
- """, baseClass = "foo.bar.Base", jfos = listOf(parent)) { entity, invocation ->
+ """, baseClass = "foo.bar.Base", jfos = listOf(parent)) { entity, _ ->
assertThat(entity.indices.isEmpty(), `is`(true))
}.compilesWithoutError()
.withWarningContaining(
@@ -746,7 +746,7 @@
@ColumnInfo(index = true)
public int a;
}
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.indices.isEmpty(), `is`(true))
}.compilesWithoutError()
.withWarningContaining(
@@ -770,7 +770,7 @@
@ColumnInfo(index = true)
public int a;
}
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.indices.isEmpty(), `is`(true))
}.failsToCompile().withErrorContaining(
ProcessorErrors.CANNOT_USE_MORE_THAN_ONE_POJO_FIELD_ANNOTATION
@@ -789,7 +789,7 @@
@ColumnInfo(index = true)
public int a;
}
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.indices.isEmpty(), `is`(true))
}.compilesWithoutError()
.withWarningContaining(
@@ -808,7 +808,7 @@
static class Foo {
public int a;
}
- """, attributes = mapOf("indices" to "@Index(\"a\")")) { entity, invocation ->
+ """, attributes = mapOf("indices" to "@Index(\"a\")")) { entity, _ ->
assertThat(entity.indices.size, `is`(1))
assertThat(entity.indices.first(), `is`(
Index(
@@ -828,7 +828,7 @@
@PrimaryKey
public String foo;
""",
- attributes = mapOf("primaryKeys" to "\"id\"")) { entity, invocation ->
+ attributes = mapOf("primaryKeys" to "\"id\"")) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.multiplePrimaryKeyAnnotations(
listOf("PrimaryKey[id]", "PrimaryKey[foo]")
@@ -841,7 +841,7 @@
"""
public int id;
""",
- attributes = mapOf("primaryKeys" to "\"foo\"")) { entity, invocation ->
+ attributes = mapOf("primaryKeys" to "\"foo\"")) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.primaryKeyColumnDoesNotExist("foo", listOf("id")))
}
@@ -853,7 +853,7 @@
int x;
@PrimaryKey
int y;
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.primaryKey.fields.isEmpty(), `is`(true))
}.failsToCompile()
.withErrorContaining(
@@ -878,7 +878,7 @@
public int id;
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("baseId"))
}.compilesWithoutError().withWarningCount(0)
@@ -901,7 +901,7 @@
public int id;
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("baseId"))
}.compilesWithoutError().withWarningCount(0)
}
@@ -924,7 +924,7 @@
public int id;
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.size, `is`(1))
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("id"))
assertThat(entity.primaryKey.autoGenerateId, `is`(false))
@@ -951,7 +951,7 @@
public int id;
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.size, `is`(1))
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("id"))
}.compilesWithoutError().withNoteContaining(
@@ -977,7 +977,7 @@
""",
baseClass = "foo.bar.Base",
jfos = listOf(parent),
- attributes = mapOf("primaryKeys" to "\"id\"")) { entity, invocation ->
+ attributes = mapOf("primaryKeys" to "\"id\"")) { entity, _ ->
assertThat(entity.primaryKey.fields.size, `is`(1))
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("id"))
assertThat(entity.primaryKey.autoGenerateId, `is`(false))
@@ -993,7 +993,7 @@
"""
@PrimaryKey(autoGenerate = true)
public $type id;
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.primaryKey.fields.size, `is`(1))
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("id"))
assertThat(entity.primaryKey.autoGenerateId, `is`(true))
@@ -1008,7 +1008,7 @@
"""
@PrimaryKey(autoGenerate = true)
public $type id;
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.primaryKey.fields.size, `is`(1))
assertThat(entity.primaryKey.fields.firstOrNull()?.name, `is`("id"))
assertThat(entity.primaryKey.autoGenerateId, `is`(true))
@@ -1031,7 +1031,7 @@
public int a;
public int b;
}
- """) { entity, invocation ->
+ """) { entity, _ ->
assertThat(entity.primaryKey.fields.map { it.columnName },
`is`(listOf("bar_a", "bar_b")))
}.compilesWithoutError().withWarningCount(0)
@@ -1062,7 +1062,7 @@
public int id;
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.map { it.columnName },
`is`(listOf("bar_a", "bar_b")))
}.compilesWithoutError().withWarningCount(0)
@@ -1094,7 +1094,7 @@
}
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.map { it.columnName },
`is`(listOf("bar_a", "bar_b")))
}.compilesWithoutError().withNoteContaining(
@@ -1127,7 +1127,7 @@
public int id;
""",
baseClass = "foo.bar.Base",
- jfos = listOf(parent)) { entity, invocation ->
+ jfos = listOf(parent)) { entity, _ ->
assertThat(entity.primaryKey.fields.map { it.columnName },
`is`(listOf("id")))
}.compilesWithoutError().withNoteContaining(
@@ -1143,7 +1143,7 @@
@Relation(parentColumn = "id", entityColumn = "uid")
java.util.List<User> users;
""", jfos = listOf(COMMON.USER)
- ) { entity, invocation ->
+ ) { _, _ ->
}.failsToCompile().withErrorContaining(RELATION_IN_ENTITY)
}
@@ -1164,7 +1164,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.INVALID_FOREIGN_KEY_ACTION)
}
@@ -1184,7 +1184,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining("cannot find symbol")
}
@@ -1204,7 +1204,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.NOT_AN_ENTITY)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.foreignKeyNotAnEntity(
COMMON.NOT_AN_ENTITY_TYPE_NAME.toString()))
}
@@ -1225,7 +1225,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.foreignKeyChildColumnDoesNotExist(
"namex", listOf("id", "name")))
}
@@ -1246,7 +1246,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.foreignKeyColumnNumberMismatch(
listOf("name", "id"), listOf("lastName")))
}
@@ -1267,7 +1267,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.FOREIGN_KEY_EMPTY_CHILD_COLUMN_LIST)
}
@@ -1287,7 +1287,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.FOREIGN_KEY_EMPTY_PARENT_COLUMN_LIST)
}
@@ -1310,7 +1310,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ entity, _ ->
assertThat(entity.foreignKeys.size, `is`(1))
val fKey = entity.foreignKeys.first()
assertThat(fKey.parentTable, `is`("User"))
@@ -1342,7 +1342,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ) { entity, invocation ->
+ ) { _, _ ->
}.compilesWithoutWarnings()
}
@@ -1367,7 +1367,7 @@
String lName;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ) { entity, invocation ->
+ ) { entity, _ ->
assertThat(entity.indices.size, `is`(1))
}.compilesWithoutWarnings()
}
@@ -1393,7 +1393,7 @@
String lName;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ) { entity, invocation ->
+ ) { entity, _ ->
assertThat(entity.indices.size, `is`(1))
}.compilesWithoutWarnings()
}
@@ -1417,7 +1417,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ entity, _ ->
assertThat(entity.indices, `is`(emptyList()))
}.compilesWithoutError().withWarningContaining(
ProcessorErrors.foreignKeyMissingIndexInChildColumn("name"))
@@ -1440,7 +1440,7 @@
String lName;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ entity, _ ->
assertThat(entity.indices, `is`(emptyList()))
}.compilesWithoutError().withWarningContaining(
ProcessorErrors.foreignKeyMissingIndexInChildColumns(listOf("lName", "name")))
@@ -1465,7 +1465,7 @@
String name;
""",
attributes = annotation, jfos = listOf(COMMON.USER)
- ){ entity, invocation ->
+ ){ entity, _ ->
assertThat(entity.indices, `is`(emptyList()))
}.compilesWithoutWarnings()
}
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/FieldProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/FieldProcessorTest.kt
index fb64c7c..5498340 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/FieldProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/FieldProcessorTest.kt
@@ -170,7 +170,7 @@
singleEntity("""
@ColumnInfo(name = "")
int x;
- """) { field, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.COLUMN_NAME_CANNOT_BE_EMPTY)
}
@@ -246,7 +246,7 @@
static class BaseClass<T> {
T item;
}
- """) { field, invocation -> }.failsToCompile()
+ """) { _, _ -> }.failsToCompile()
.withErrorContaining(ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_ENTITY_FIELDS)
}
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/InsertionMethodProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/InsertionMethodProcessorTest.kt
index aff6346..ffb07ed 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/InsertionMethodProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/InsertionMethodProcessorTest.kt
@@ -65,7 +65,7 @@
"""
@Insert
abstract public void foo();
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("foo"))
assertThat(insertion.parameters.size, `is`(0))
assertThat(insertion.returnType.typeName(), `is`(TypeName.VOID))
@@ -80,7 +80,7 @@
"""
@Insert
abstract public long foo(User user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("foo"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -98,7 +98,7 @@
"""
@Insert
abstract public void foo(NotAnEntity notValid);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("foo"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -115,7 +115,7 @@
"""
@Insert
abstract public void foo(User u1, User u2);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("foo"))
assertThat(insertion.parameters.size, `is`(2))
@@ -137,7 +137,7 @@
"""
@Insert
abstract public List<Long> insertUsers(List<User> users);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("insertUsers"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -160,7 +160,7 @@
"""
@Insert
abstract public void insertUsers(User[] users);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("insertUsers"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -178,7 +178,7 @@
"""
@Insert
abstract public void insertUsers(Set<User> users);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("insertUsers"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -197,7 +197,7 @@
"""
@Insert
abstract public void insertUsers(Queue<User> users);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("insertUsers"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -215,7 +215,7 @@
singleInsertMethod("""
@Insert
abstract public void insert(Iterable<User> users);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("insert"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -233,7 +233,7 @@
static class MyList<Irrelevant, Item> extends ArrayList<Item> {}
@Insert
abstract public void insert(MyList<String, User> users);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.name, `is`("insert"))
assertThat(insertion.parameters.size, `is`(1))
val param = insertion.parameters.first()
@@ -252,7 +252,7 @@
"""
@Insert
abstract public void foo(User u1, Book b1);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.parameters.size, `is`(2))
assertThat(insertion.parameters[0].type.typeName().toString(),
`is`("foo.bar.User"))
@@ -272,7 +272,7 @@
"""
@Insert
abstract public void foo(User user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.onConflict, `is`(OnConflictStrategy.ABORT))
}.compilesWithoutError()
}
@@ -283,7 +283,7 @@
"""
@Insert(onConflict = -1)
abstract public void foo(User user);
- """) { insertion, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.INVALID_ON_CONFLICT_VALUE)
}
@@ -300,7 +300,7 @@
"""
@Insert(onConflict=OnConflictStrategy.${pair.first})
abstract public void foo(User user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.onConflict, `is`(pair.second))
}.compilesWithoutError()
}
@@ -312,7 +312,7 @@
"""
@Insert
abstract public int foo(User user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.insertionType, `is`(nullValue()))
}.failsToCompile().withErrorContaining(
ProcessorErrors.INVALID_INSERTION_METHOD_RETURN_TYPE)
@@ -324,7 +324,7 @@
"""
@Insert
abstract public long[] foo(User user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.insertionType, `is`(nullValue()))
}.failsToCompile().withErrorContaining(
ProcessorErrors.insertionMethodReturnTypeMismatch(
@@ -338,7 +338,7 @@
"""
@Insert
abstract public long foo(User... user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.insertionType, `is`(nullValue()))
}.failsToCompile().withErrorContaining(
ProcessorErrors.insertionMethodReturnTypeMismatch(
@@ -352,7 +352,7 @@
"""
@Insert
abstract public long foo(User user1, User user2);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.insertionType, `is`(nullValue()))
}.failsToCompile().withErrorContaining(
ProcessorErrors.insertionMethodReturnTypeMismatch(
@@ -379,7 +379,7 @@
"""
@Insert
abstract public ${pair.first} foo(User$dots user);
- """) { insertion, invocation ->
+ """) { insertion, _ ->
assertThat(insertion.insertMethodTypeFor(insertion.parameters.first()),
`is`(pair.second))
assertThat(pair.toString(), insertion.insertionType, `is`(pair.second))
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/PojoProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/PojoProcessorTest.kt
index 0a5026a..faa6024 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/PojoProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/PojoProcessorTest.kt
@@ -58,7 +58,7 @@
class PojoProcessorTest {
companion object {
- val MY_POJO = ClassName.get("foo.bar", "MyPojo")
+ val MY_POJO: ClassName = ClassName.get("foo.bar", "MyPojo")
val HEADER = """
package foo.bar;
import android.arch.persistence.room.*;
@@ -186,7 +186,7 @@
@ColumnInfo(name = "id")
int another;
"""
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.pojoDuplicateFieldNames("id", listOf("id", "another"))
).and().withErrorContaining(
@@ -206,7 +206,7 @@
int x;
}
"""
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.pojoDuplicateFieldNames("id", listOf("id", "foo > x"))
).and().withErrorContaining(
@@ -228,7 +228,7 @@
int y;
}
"""
- ) { pojo ->
+ ) { _ ->
}.compilesWithoutError().withWarningCount(0)
}
@@ -240,7 +240,7 @@
@Relation(parentColumn = "id", entityColumn = "uid")
public User user;
""", COMMON.USER
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(RELATION_NOT_COLLECTION)
}
@@ -253,7 +253,7 @@
@Relation(parentColumn = "id", entityColumn = "uid")
public List<User> user;
""", COMMON.USER
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.CANNOT_USE_MORE_THAN_ONE_POJO_FIELD_ANNOTATION)
}
@@ -266,7 +266,7 @@
@Relation(parentColumn = "id", entityColumn = "uid")
public List<NotAnEntity> user;
""", COMMON.NOT_AN_ENTITY
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(ENTITY_MUST_BE_ANNOTATED_WITH_ENTITY)
}
@@ -278,7 +278,7 @@
@Relation(parentColumn = "idk", entityColumn = "uid")
public List<User> user;
""", COMMON.USER
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(
relationCannotFindParentEntityField("foo.bar.MyPojo", "idk", listOf("id"))
)
@@ -292,7 +292,7 @@
@Relation(parentColumn = "id", entityColumn = "idk")
public List<User> user;
""", COMMON.USER
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(
relationCannotFindEntityField("foo.bar.User", "idk",
listOf("uid", "name", "lastName", "age"))
@@ -307,7 +307,7 @@
@Relation(parentColumn = "id", entityColumn = "uid")
public List<User> user;
"""
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(CANNOT_FIND_TYPE)
}
@@ -343,7 +343,7 @@
@Relation(parentColumn = "id", entityColumn = "uid", entity = User.class)
public List<UserWithNested> user;
""", COMMON.USER
- ) { pojo, invocation ->
+ ) { pojo, _ ->
assertThat(pojo.relations.first().parentField.name, `is`("id"))
}.compilesWithoutError().withWarningCount(0)
}
@@ -394,7 +394,7 @@
@Relation(parentColumn = "id", entityColumn = "uid", projection={"i_dont_exist"})
public List<User> user;
""", COMMON.USER
- ) { pojo ->
+ ) { _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.relationBadProject("foo.bar.User", listOf("i_dont_exist"),
listOf("uid", "name", "lastName", "ageColumn"))
@@ -461,10 +461,10 @@
@Test
fun constructor_empty() {
- val pojo = """
+ val pojoCode = """
public String mName;
"""
- singleRun(pojo) { pojo ->
+ singleRun(pojoCode) { pojo ->
assertThat(pojo.constructor, notNullValue())
assertThat(pojo.constructor?.params, `is`(emptyList<Constructor.Param>()))
}.compilesWithoutError()
@@ -472,13 +472,13 @@
@Test
fun constructor_ambiguous_twoFieldsExcatMatch() {
- val pojo = """
+ val pojoCode = """
public String mName;
public String _name;
public MyPojo(String mName) {
}
"""
- singleRun(pojo) { pojo ->
+ singleRun(pojoCode) { pojo ->
val param = pojo.constructor?.params?.first()
assertThat(param, instanceOf(Constructor.FieldParam::class.java))
assertThat((param as Constructor.FieldParam).field.name, `is`("mName"))
@@ -489,13 +489,13 @@
@Test
fun constructor_ambiguous_oneTypeMatches() {
- val pojo = """
+ val pojoCode = """
public String mName;
public int _name;
public MyPojo(String name) {
}
"""
- singleRun(pojo) { pojo ->
+ singleRun(pojoCode) { pojo ->
val param = pojo.constructor?.params?.first()
assertThat(param, instanceOf(Constructor.FieldParam::class.java))
assertThat((param as Constructor.FieldParam).field.name, `is`("mName"))
@@ -512,7 +512,7 @@
public MyPojo(String name) {
}
"""
- singleRun(pojo) { pojo ->
+ singleRun(pojo) { _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.ambigiousConstructor(MY_POJO.toString(),
"name", listOf("mName", "_name"))
@@ -525,7 +525,7 @@
int foo;
public MyPojo(String foo) {
}
- """) { pojo ->
+ """) { _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.MISSING_POJO_CONSTRUCTOR)
}
@@ -536,7 +536,7 @@
String _name;
public MyPojo(String foo) {
}
- """) { pojo ->
+ """) { _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.MISSING_POJO_CONSTRUCTOR)
}
@@ -547,7 +547,7 @@
int bar;
public MyPojo(String foo, String name) {
}
- """) { pojo ->
+ """) { _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.MISSING_POJO_CONSTRUCTOR)
}
@@ -560,7 +560,7 @@
}
public MyPojo(String name, String lastName) {
}
- """) { pojo ->
+ """) { _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.TOO_MANY_POJO_CONSTRUCTORS)
}
@@ -589,7 +589,7 @@
singleRun("""
String mName;
String mLastName;
- """) { pojo, invocation ->
+ """) { _, invocation ->
val process2 = PojoProcessor(baseContext = invocation.context,
element = invocation.typeElement(MY_POJO.toString()),
bindingScope = FieldProcessor.BindingScope.BIND_TO_STMT,
@@ -603,7 +603,7 @@
singleRun("""
String mName;
String mLastName;
- """) { pojo, invocation ->
+ """) { _, invocation ->
val process2 = PojoProcessor(baseContext = invocation.context,
element = invocation.typeElement(MY_POJO.toString()),
bindingScope = FieldProcessor.BindingScope.TWO_WAY,
@@ -614,7 +614,7 @@
fun singleRun(code: String, vararg jfos:JavaFileObject, handler: (Pojo) -> Unit)
: CompileTester {
- return singleRun(code, *jfos) { pojo, invocation ->
+ return singleRun(code, *jfos) { pojo, _ ->
handler(pojo)
}
}
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/QueryMethodProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/QueryMethodProcessorTest.kt
index f7affbc..c80dd87 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/QueryMethodProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/QueryMethodProcessorTest.kt
@@ -71,7 +71,7 @@
abstract class MyClass {
"""
const val DAO_SUFFIX = "}"
- val POJO = ClassName.get("foo.bar", "MyClass.Pojo")
+ val POJO: ClassName = ClassName.get("foo.bar", "MyClass.Pojo")
@Parameterized.Parameters(name = "enableDbVerification={0}")
@JvmStatic
fun getParams() = arrayOf(true, false)
@@ -94,7 +94,7 @@
"""
@Query("SELECT * from User")
abstract public int[] foo();
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
assertThat(parsedQuery.name, `is`("foo"))
assertThat(parsedQuery.parameters.size, `is`(0))
assertThat(parsedQuery.returnType.typeName(),
@@ -143,7 +143,7 @@
"""
@Query("SELECT uid from User where uid = :id")
abstract public long getIdById(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val section = parsedQuery.query.bindSections.first()
val param = parsedQuery.parameters.firstOrNull()
assertThat(section, notNullValue())
@@ -158,7 +158,7 @@
"""
@Query("SELECT uid from User where uid = :id")
abstract public long getIdById(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val section = parsedQuery.query.bindSections.first()
val param = parsedQuery.parameters.firstOrNull()
assertThat(section, notNullValue())
@@ -174,7 +174,7 @@
"""
@Query("SELECT uid from User where uid = :id OR uid = :id")
abstract public long getIdById(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val section = parsedQuery.query.bindSections[0]
val section2 = parsedQuery.query.bindSections[1]
val param = parsedQuery.parameters.firstOrNull()
@@ -192,7 +192,7 @@
"""
@Query("SELECT uid from User where uid = :id OR uid = :uid")
abstract public long getIdById(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val section = parsedQuery.query.bindSections[0]
val section2 = parsedQuery.query.bindSections[1]
val param = parsedQuery.parameters.firstOrNull()
@@ -213,7 +213,7 @@
"""
@Query("SELECT uid from User where name = :bar AND uid = :id OR uid = :uid")
abstract public long getIdById(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val bar = parsedQuery.query.bindSections[0]
val id = parsedQuery.query.bindSections[1]
val uid = parsedQuery.query.bindSections[2]
@@ -236,7 +236,7 @@
"""
@Query("SELECT uid from User where name = :bar")
abstract public long getIdById(int bar, int whyNotUseMe);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val bar = parsedQuery.query.bindSections[0]
val barParam = parsedQuery.parameters.firstOrNull()
assertThat(bar, notNullValue())
@@ -254,7 +254,7 @@
@Query("select * from User where uid = :_blah")
abstract public long getSth(int _blah);
"""
- ) { parsedQuery, invocation -> }
+ ) { _, _ -> }
.failsToCompile()
.withErrorContaining(ProcessorErrors.QUERY_PARAMETERS_CANNOT_START_WITH_UNDERSCORE)
}
@@ -265,7 +265,7 @@
"""
@Query("select * from User")
abstract public <T> java.util.List<T> foo(int x);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
val expected: TypeName = ParameterizedTypeName.get(ClassName.get(List::class.java),
TypeVariableName.get("T"))
assertThat(parsedQuery.returnType.typeName(), `is`(expected))
@@ -279,7 +279,7 @@
"""
@Query("select * from :1 :2")
abstract public long foo(int x);
- """) { parsedQuery, invocation ->
+ """) { _, _ ->
// do nothing
}.failsToCompile()
.withErrorContaining("UNEXPECTED_CHAR=:")
@@ -296,7 +296,7 @@
@Dao
static abstract class ExtendingModel extends BaseModel<Integer> {
}
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
assertThat(parsedQuery.returnType.typeName(),
`is`(ClassName.get(Integer::class.java) as TypeName))
}.compilesWithoutError()
@@ -326,7 +326,7 @@
"""
@Query("DELETE from User where uid = :id")
abstract public float foo(int id);
- """) { parsedQuery, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(
ProcessorErrors.DELETION_METHODS_MUST_RETURN_VOID_OR_INT
)
@@ -338,7 +338,7 @@
"""
@Query("DELETE from User where uid = :id")
abstract public int foo(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
assertThat(parsedQuery.name, `is`("foo"))
assertThat(parsedQuery.parameters.size, `is`(1))
assertThat(parsedQuery.returnType.typeName(), `is`(TypeName.INT))
@@ -351,7 +351,7 @@
"""
@Query("DELETE from User where uid = :id")
abstract public void foo(int id);
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
assertThat(parsedQuery.name, `is`("foo"))
assertThat(parsedQuery.parameters.size, `is`(1))
assertThat(parsedQuery.returnType.typeName(), `is`(TypeName.VOID))
@@ -380,7 +380,7 @@
@Query("select name from user where uid = :id")
abstract ${LifecyclesTypeNames.LIVE_DATA}<String> nameLiveData(String id);
"""
- ) { parsedQuery, invocation ->
+ ) { parsedQuery, _ ->
assertThat(parsedQuery.returnType.typeName(),
`is`(ParameterizedTypeName.get(LifecyclesTypeNames.LIVE_DATA,
String::class.typeName()) as TypeName))
@@ -396,7 +396,7 @@
@Query("delete from user where uid = :id")
abstract ${LifecyclesTypeNames.LIVE_DATA}<Integer> deleteLiveData(String id);
"""
- ) { parsedQuery, invocation ->
+ ) { _, _ ->
}.failsToCompile()
.withErrorContaining(ProcessorErrors.DELETION_METHODS_MUST_RETURN_VOID_OR_INT)
}
@@ -408,7 +408,7 @@
@SkipQueryVerification
@Query("SELECT foo from User")
abstract public int[] foo();
- """) { parsedQuery, invocation ->
+ """) { parsedQuery, _ ->
assertThat(parsedQuery.name, `is`("foo"))
assertThat(parsedQuery.parameters.size, `is`(0))
assertThat(parsedQuery.returnType.typeName(),
@@ -437,7 +437,7 @@
pojoTest("""
String name;
String lName;
- """, listOf("name", "lastName as lName")) { adapter, queryMethod, invocation ->
+ """, listOf("name", "lastName as lName")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(emptyList()))
assertThat(adapter?.mapping?.unusedFields, `is`(emptyList()))
}?.compilesWithoutError()?.withWarningCount(0)
@@ -448,7 +448,7 @@
pojoTest("""
String name;
String lastName;
- """, listOf("name", "lastName")) { adapter, queryMethod, invocation ->
+ """, listOf("name", "lastName")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(emptyList()))
assertThat(adapter?.mapping?.unusedFields, `is`(emptyList()))
}?.compilesWithoutError()?.withWarningCount(0)
@@ -462,7 +462,7 @@
int uid;
@ColumnInfo(name = "ageColumn")
int age;
- """, listOf("*")) { adapter, queryMethod, invocation ->
+ """, listOf("*")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(emptyList()))
assertThat(adapter?.mapping?.unusedFields, `is`(emptyList()))
}?.compilesWithoutError()?.withWarningCount(0)
@@ -474,7 +474,7 @@
@ColumnInfo(name = "MAX(ageColumn)")
int maxAge;
String name;
- """, listOf("MAX(ageColumn)", "name")) { adapter, queryMethod, invocation ->
+ """, listOf("MAX(ageColumn)", "name")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(emptyList()))
assertThat(adapter?.mapping?.unusedFields, `is`(emptyList()))
}?.compilesWithoutError()?.withWarningCount(0)
@@ -485,7 +485,7 @@
pojoTest("""
String nameX;
String lastNameX;
- """, listOf("name", "lastName")) { adapter, queryMethod, invocation ->
+ """, listOf("name", "lastName")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(listOf("name", "lastName")))
assertThat(adapter?.mapping?.unusedFields, `is`(adapter?.pojo?.fields))
}?.failsToCompile()
@@ -510,7 +510,7 @@
@ColumnInfo(name = "MAX(ageColumn)")
int maxAge;
String name;
- """, listOf("MAX(age)", "name")) { adapter, queryMethod, invocation ->
+ """, listOf("MAX(age)", "name")) { _, _, _ ->
}?.failsToCompile()
?.withErrorContaining("no such column: age")
?.and()
@@ -523,7 +523,7 @@
pojoTest("""
String name;
String lastName;
- """, listOf("uid", "name", "lastName")) { adapter, queryMethod, invocation ->
+ """, listOf("uid", "name", "lastName")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(listOf("uid")))
assertThat(adapter?.mapping?.unusedFields, `is`(emptyList()))
}?.compilesWithoutError()?.withWarningContaining(
@@ -541,7 +541,7 @@
pojoTest("""
String name;
String lastName;
- """, listOf("lastName")) { adapter, queryMethod, invocation ->
+ """, listOf("lastName")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(emptyList()))
assertThat(adapter?.mapping?.unusedFields, `is`(
adapter?.pojo?.fields?.filter { it.name == "name" }
@@ -561,7 +561,7 @@
pojoTest("""
String name;
String lastName;
- """, listOf("uid", "name")) { adapter, queryMethod, invocation ->
+ """, listOf("uid", "name")) { adapter, _, _ ->
assertThat(adapter?.mapping?.unusedColumns, `is`(listOf("uid")))
assertThat(adapter?.mapping?.unusedFields, `is`(
adapter?.pojo?.fields?.filter { it.name == "lastName" }
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/ShortcutMethodProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/ShortcutMethodProcessorTest.kt
index a4d670c..c4ef416 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/ShortcutMethodProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/ShortcutMethodProcessorTest.kt
@@ -64,7 +64,7 @@
"""
@${annotation.java.canonicalName}
abstract public void foo();
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("foo"))
assertThat(shortcut.parameters.size, `is`(0))
assertThat(shortcut.returnCount, `is`(false))
@@ -79,7 +79,7 @@
"""
@${annotation.java.canonicalName}
abstract public int foo(User user);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("foo"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -97,7 +97,7 @@
"""
@${annotation.java.canonicalName}
abstract public void foo(NotAnEntity notValid);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("foo"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -114,7 +114,7 @@
"""
@${annotation.java.canonicalName}
abstract public void foo(User u1, User u2);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("foo"))
assertThat(shortcut.parameters.size, `is`(2))
@@ -137,7 +137,7 @@
"""
@${annotation.java.canonicalName}
abstract public int users(List<User> users);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("users"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -157,7 +157,7 @@
"""
@${annotation.java.canonicalName}
abstract public void users(User[] users);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("users"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -175,7 +175,7 @@
"""
@${annotation.java.canonicalName}
abstract public void modifyUsers(Set<User> users);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("modifyUsers"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -194,7 +194,7 @@
"""
@${annotation.java.canonicalName}
abstract public void modifyUsers(Iterable<User> users);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("modifyUsers"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -214,7 +214,7 @@
static class MyList<Irrelevant, Item> extends ArrayList<Item> {}
@${annotation.java.canonicalName}
abstract public void modifyUsers(MyList<String, User> users);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.name, `is`("modifyUsers"))
assertThat(shortcut.parameters.size, `is`(1))
val param = shortcut.parameters.first()
@@ -234,7 +234,7 @@
"""
@${annotation.java.canonicalName}
abstract public void foo(User u1, Book b1);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.parameters.size, `is`(2))
assertThat(shortcut.parameters[0].type.typeName().toString(),
`is`("foo.bar.User"))
@@ -254,7 +254,7 @@
"""
@${annotation.java.canonicalName}
abstract public long foo(User user);
- """) { shortcut, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(invalidReturnTypeError())
}
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/UpdateMethodProcessorTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/UpdateMethodProcessorTest.kt
index c8a88ae..84ff0f1 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/UpdateMethodProcessorTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/processor/UpdateMethodProcessorTest.kt
@@ -47,7 +47,7 @@
"""
@Update(onConflict = OnConflictStrategy.REPLACE)
abstract public void foo(User user);
- """) { shortcut, invocation ->
+ """) { shortcut, _ ->
assertThat(shortcut.onConflictStrategy, `is`(OnConflictStrategy.REPLACE))
}.compilesWithoutError()
}
@@ -58,7 +58,7 @@
"""
@Update(onConflict = -1)
abstract public void foo(User user);
- """) { shortcut, invocation ->
+ """) { _, _ ->
}.failsToCompile().withErrorContaining(ProcessorErrors.INVALID_ON_CONFLICT_VALUE)
}
}
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/solver/CustomTypeConverterResolutionTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/solver/CustomTypeConverterResolutionTest.kt
index 1790788..545556e 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/solver/CustomTypeConverterResolutionTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/solver/CustomTypeConverterResolutionTest.kt
@@ -30,7 +30,6 @@
import android.arch.persistence.room.ext.S
import android.arch.persistence.room.ext.T
import android.arch.persistence.room.processor.ProcessorErrors.CANNOT_BIND_QUERY_PARAMETER_INTO_STMT
-import android.arch.persistence.room.testing.TestInvocation
import com.google.common.truth.Truth
import com.google.testing.compile.CompileTester
import com.google.testing.compile.JavaFileObjects
@@ -91,9 +90,7 @@
val entity = createEntity(hasCustomField = true)
val database = createDatabase(hasConverters = true, hasDao = true)
val dao = createDao(hasQueryReturningEntity = true, hasQueryWithCustomParam = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -101,9 +98,7 @@
val entity = createEntity()
val database = createDatabase(hasConverters = true, hasDao = true)
val dao = createDao(hasQueryWithCustomParam = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -111,9 +106,7 @@
val entity = createEntity(hasCustomField = true)
val database = createDatabase(hasConverters = true, hasDao = true)
val dao = createDao(hasQueryReturningEntity = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -122,9 +115,7 @@
val database = createDatabase(hasDao = true)
val dao = createDao(hasConverters = true, hasQueryReturningEntity = true,
hasQueryWithCustomParam = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -132,9 +123,7 @@
val entity = createEntity(hasCustomField = true, hasConverters = true)
val database = createDatabase(hasDao = true)
val dao = createDao(hasQueryReturningEntity = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -142,9 +131,7 @@
val entity = createEntity(hasCustomField = true, hasConverterOnField = true)
val database = createDatabase(hasDao = true)
val dao = createDao(hasQueryReturningEntity = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -152,9 +139,8 @@
val entity = createEntity(hasCustomField = true, hasConverters = true)
val database = createDatabase(hasDao = true)
val dao = createDao(hasQueryWithCustomParam = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.failsToCompile().withErrorContaining(CANNOT_BIND_QUERY_PARAMETER_INTO_STMT)
+ run(entity.toJFO(), dao.toJFO(), database.toJFO())
+ .failsToCompile().withErrorContaining(CANNOT_BIND_QUERY_PARAMETER_INTO_STMT)
}
@Test
@@ -162,9 +148,8 @@
val entity = createEntity(hasCustomField = true, hasConverterOnField = true)
val database = createDatabase(hasDao = true)
val dao = createDao(hasQueryWithCustomParam = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.failsToCompile().withErrorContaining(CANNOT_BIND_QUERY_PARAMETER_INTO_STMT)
+ run(entity.toJFO(), dao.toJFO(), database.toJFO())
+ .failsToCompile().withErrorContaining(CANNOT_BIND_QUERY_PARAMETER_INTO_STMT)
}
@Test
@@ -172,9 +157,7 @@
val entity = createEntity()
val database = createDatabase(hasDao = true)
val dao = createDao(hasQueryWithCustomParam = true, hasMethodConverters = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
@Test
@@ -182,12 +165,10 @@
val entity = createEntity()
val database = createDatabase(hasDao = true)
val dao = createDao(hasQueryWithCustomParam = true, hasParameterConverters = true)
- run(entity.toJFO(), dao.toJFO(), database.toJFO()){
-
- }.compilesWithoutError()
+ run(entity.toJFO(), dao.toJFO(), database.toJFO()).compilesWithoutError()
}
- fun run(vararg jfos : JavaFileObject, f: (TestInvocation) -> Unit): CompileTester {
+ fun run(vararg jfos : JavaFileObject): CompileTester {
return Truth.assertAbout(JavaSourcesSubjectFactory.javaSources())
.that(jfos.toList() + CUSTOM_TYPE_JFO + CUSTOM_TYPE_CONVERTER_JFO)
.processedWith(RoomProcessor())
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/verifier/DatabaseVerifierTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/verifier/DatabaseVerifierTest.kt
index 604c50f..ef5c4ef 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/verifier/DatabaseVerifierTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/verifier/DatabaseVerifierTest.kt
@@ -157,7 +157,7 @@
fun testBadQuery() {
simpleRun { invocation ->
val verifier = createVerifier(invocation)
- val (columns, error) = verifier.analyze("select foo from User")
+ val (_, error) = verifier.analyze("select foo from User")
assertThat(error, notNullValue())
}.compilesWithoutError()
}
diff --git a/room/compiler/src/test/kotlin/android/arch/persistence/room/writer/SQLiteOpenHelperWriterTest.kt b/room/compiler/src/test/kotlin/android/arch/persistence/room/writer/SQLiteOpenHelperWriterTest.kt
index 26efb4b..b93972f 100644
--- a/room/compiler/src/test/kotlin/android/arch/persistence/room/writer/SQLiteOpenHelperWriterTest.kt
+++ b/room/compiler/src/test/kotlin/android/arch/persistence/room/writer/SQLiteOpenHelperWriterTest.kt
@@ -59,7 +59,7 @@
String name;
int age;
""".trimIndent()
- ) { database, invocation ->
+ ) { database, _ ->
val query = SQLiteOpenHelperWriter(database)
.createQuery(database.entities.first())
assertThat(query, `is`("CREATE TABLE IF NOT EXISTS" +
@@ -76,7 +76,7 @@
String name;
int age;
""".trimIndent(), attributes = mapOf("primaryKeys" to "{\"uuid\", \"name\"}")
- ) { database, invocation ->
+ ) { database, _ ->
val query = SQLiteOpenHelperWriter(database)
.createQuery(database.entities.first())
assertThat(query, `is`("CREATE TABLE IF NOT EXISTS" +
@@ -94,7 +94,7 @@
String name;
int age;
""".trimIndent()
- ) { database, invocation ->
+ ) { database, _ ->
val query = SQLiteOpenHelperWriter(database)
.createQuery(database.entities.first())
assertThat(query, `is`("CREATE TABLE IF NOT EXISTS" +
diff --git a/transition/api/26.1.0-SNAPSHOT.txt b/transition/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from transition/api/26.1.0-SNAPSHOT.txt
rename to transition/api/27.0.0-SNAPSHOT.txt
diff --git a/tv-provider/api/26.1.0-SNAPSHOT.txt b/tv-provider/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from tv-provider/api/26.1.0-SNAPSHOT.txt
rename to tv-provider/api/27.0.0-SNAPSHOT.txt
diff --git a/v13/Android.mk b/v13/Android.mk
index 3ad5472..1a95b75 100644
--- a/v13/Android.mk
+++ b/v13/Android.mk
@@ -38,5 +38,6 @@
android-support-annotations
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
LOCAL_AAPT_FLAGS := --add-javadoc-annotation doconly
+LOCAL_JAR_EXCLUDE_FILES := none
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v13/api/26.1.0-SNAPSHOT.txt b/v13/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v13/api/26.1.0-SNAPSHOT.txt
rename to v13/api/27.0.0-SNAPSHOT.txt
diff --git a/v14/preference/api/26.1.0-SNAPSHOT.txt b/v14/preference/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v14/preference/api/26.1.0-SNAPSHOT.txt
rename to v14/preference/api/27.0.0-SNAPSHOT.txt
diff --git a/v17/leanback/api/26.1.0-SNAPSHOT.txt b/v17/leanback/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v17/leanback/api/26.1.0-SNAPSHOT.txt
rename to v17/leanback/api/27.0.0-SNAPSHOT.txt
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java b/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java
index 6d627b3..18f608e 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java
@@ -214,6 +214,8 @@
if (DEBUG) Log.v(TAG, "EditText.onFocusChange " + hasFocus);
if (hasFocus) {
showNativeKeyboard();
+ } else {
+ hideNativeKeyboard();
}
updateUi(hasFocus);
}
diff --git a/v17/preference-leanback/api/26.1.0-SNAPSHOT.txt b/v17/preference-leanback/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v17/preference-leanback/api/26.1.0-SNAPSHOT.txt
rename to v17/preference-leanback/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/appcompat/api/26.1.0-SNAPSHOT.txt b/v7/appcompat/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/appcompat/api/26.1.0-SNAPSHOT.txt
rename to v7/appcompat/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/appcompat/res-public/values/public_styles.xml b/v7/appcompat/res-public/values/public_styles.xml
index a9956ad..38efc46 100644
--- a/v7/appcompat/res-public/values/public_styles.xml
+++ b/v7/appcompat/res-public/values/public_styles.xml
@@ -36,12 +36,6 @@
<public type="style" name="TextAppearance.AppCompat.Medium"/>
<public type="style" name="TextAppearance.AppCompat.Medium.Inverse"/>
<public type="style" name="TextAppearance.AppCompat.Menu"/>
- <public type="style" name="TextAppearance.AppCompat.Notification"/>
- <public type="style" name="TextAppearance.AppCompat.Notification.Info"/>
- <public type="style" name="TextAppearance.AppCompat.Notification.Line2"/>
- <public type="style" name="TextAppearance.AppCompat.Notification.Media"/>
- <public type="style" name="TextAppearance.AppCompat.Notification.Time"/>
- <public type="style" name="TextAppearance.AppCompat.Notification.Title"/>
<public type="style" name="TextAppearance.AppCompat.SearchResult.Subtitle"/>
<public type="style" name="TextAppearance.AppCompat.SearchResult.Title"/>
<public type="style" name="TextAppearance.AppCompat.Small"/>
diff --git a/v7/appcompat/res/values-v21/styles.xml b/v7/appcompat/res/values-v21/styles.xml
deleted file mode 100644
index 48d0366..0000000
--- a/v7/appcompat/res/values-v21/styles.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<!--
- ~ Copyright (C) 2016 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<resources>
-
- <!-- Use platform styles -->
- <style name="TextAppearance.AppCompat.Notification.Info"
- parent="@android:style/TextAppearance.Material.Notification.Info"/>
-
- <style name="TextAppearance.AppCompat.Notification.Time"
- parent="@android:style/TextAppearance.Material.Notification.Time"/>
-
- <style name="TextAppearance.AppCompat.Notification.Title"
- parent="@android:style/TextAppearance.Material.Notification.Title"/>
-
- <style name="TextAppearance.AppCompat.Notification"
- parent="@android:style/TextAppearance.Material.Notification"/>
-
- <style name="TextAppearance.AppCompat.Notification.Media" >
- <item name="android:textColor">@color/secondary_text_default_material_dark</item>
- </style>
-
- <style name="TextAppearance.AppCompat.Notification.Title.Media" >
- <item name="android:textColor">@color/primary_text_default_material_dark</item>
- </style>
-
- <style name="TextAppearance.AppCompat.Notification.Info.Media">
- <item name="android:textColor">@color/secondary_text_default_material_dark</item>
- </style>
-
- <style name="TextAppearance.AppCompat.Notification.Time.Media">
- <item name="android:textColor">@color/secondary_text_default_material_dark</item>
- </style>
-</resources>
\ No newline at end of file
diff --git a/v7/appcompat/res/values-v24/styles.xml b/v7/appcompat/res/values-v24/styles.xml
deleted file mode 100644
index 4cd8461..0000000
--- a/v7/appcompat/res/values-v24/styles.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
- ~ Copyright (C) 2016 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<resources>
- <!-- Use platform styles, Media is dark again -->
- <style name="TextAppearance.AppCompat.Notification.Media" />
-
- <style name="TextAppearance.AppCompat.Notification.Info.Media" />
-
- <style name="TextAppearance.AppCompat.Notification.Time.Media" />
-
- <style name="TextAppearance.AppCompat.Notification.Title.Media" />
-</resources>
diff --git a/v7/appcompat/res/values/styles.xml b/v7/appcompat/res/values/styles.xml
index ce74a89..247ca4c 100644
--- a/v7/appcompat/res/values/styles.xml
+++ b/v7/appcompat/res/values/styles.xml
@@ -329,25 +329,4 @@
<style name="TextAppearance.AppCompat.Light.Widget.PopupMenu.Large" parent="TextAppearance.AppCompat.Widget.PopupMenu.Large" />
<style name="TextAppearance.AppCompat.Light.Widget.PopupMenu.Small" parent="TextAppearance.AppCompat.Widget.PopupMenu.Small" />
- <!-- These styles have moved to support-compat and should be removed when
- android.support.v7.app.NotificationCompat is removed -->
- <style name="TextAppearance.AppCompat.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" />
- <style name="TextAppearance.AppCompat.Notification.Title" parent="@android:style/TextAppearance.StatusBar.EventContent.Title" />
- <style name="TextAppearance.AppCompat.Notification.Info">
- <item name="android:textSize">12sp</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
- </style>
- <style name="TextAppearance.AppCompat.Notification.Time">
- <item name="android:textSize">12sp</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
- </style>
- <style name="TextAppearance.AppCompat.Notification.Line2" parent="TextAppearance.AppCompat.Notification.Info" />
-
- <!-- These styles have moved to media-compat and should be removed when
- android.support.v7.app.NotificationCompat is removed -->
- <style name="TextAppearance.AppCompat.Notification.Title.Media" />
- <style name="TextAppearance.AppCompat.Notification.Media" />
- <style name="TextAppearance.AppCompat.Notification.Info.Media" />
- <style name="TextAppearance.AppCompat.Notification.Time.Media" />
- <style name="TextAppearance.AppCompat.Notification.Line2.Media" parent="TextAppearance.AppCompat.Notification.Info.Media" />
</resources>
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
index b1c3e95..6e10d9c 100644
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
+++ b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
@@ -260,8 +260,8 @@
* </pre>
*
* <p>If you are using this style, consider using the corresponding styles like
- * {@link android.support.v7.appcompat.R.style#TextAppearance_AppCompat_Notification} or
- * {@link android.support.v7.appcompat.R.style#TextAppearance_AppCompat_Notification_Title} in
+ * {@link android.support.compat.R.style#TextAppearance_Compat_Notification} or
+ * {@link android.support.compat.R.style#TextAppearance_Compat_Notification_Title} in
* your custom views in order to get the correct styling on each platform version.
*
* @deprecated Use {@link android.support.v4.app.NotificationCompat.DecoratedCustomViewStyle}
@@ -308,9 +308,9 @@
* </pre>
*
* <p>If you are using this style, consider using the corresponding styles like
- * {@link android.support.v7.appcompat.R.style#TextAppearance_AppCompat_Notification_Media} or
+ * {@link android.support.mediacompat.R.style#TextAppearance_Compat_Notification_Media} or
* {@link
- * android.support.v7.appcompat.R.style#TextAppearance_AppCompat_Notification_Title_Media} in
+ * android.support.mediacompat.R.style#TextAppearance_Compat_Notification_Title_Media} in
* your custom views in order to get the correct styling on each platform version.
*
* @see android.support.v4.app.NotificationCompat.DecoratedCustomViewStyle
diff --git a/v7/cardview/api/26.1.0-SNAPSHOT.txt b/v7/cardview/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/cardview/api/26.1.0-SNAPSHOT.txt
rename to v7/cardview/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/gridlayout/api/26.1.0-SNAPSHOT.txt b/v7/gridlayout/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/gridlayout/api/26.1.0-SNAPSHOT.txt
rename to v7/gridlayout/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/mediarouter/api/26.1.0-SNAPSHOT.txt b/v7/mediarouter/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/mediarouter/api/26.1.0-SNAPSHOT.txt
rename to v7/mediarouter/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/palette/api/26.1.0-SNAPSHOT.txt b/v7/palette/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/palette/api/26.1.0-SNAPSHOT.txt
rename to v7/palette/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/preference/api/26.1.0-SNAPSHOT.txt b/v7/preference/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/preference/api/26.1.0-SNAPSHOT.txt
rename to v7/preference/api/27.0.0-SNAPSHOT.txt
diff --git a/v7/recyclerview/api/26.1.0-SNAPSHOT.txt b/v7/recyclerview/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from v7/recyclerview/api/26.1.0-SNAPSHOT.txt
rename to v7/recyclerview/api/27.0.0-SNAPSHOT.txt
diff --git a/wear/api/26.1.0-SNAPSHOT.txt b/wear/api/27.0.0-SNAPSHOT.txt
similarity index 100%
rename from wear/api/26.1.0-SNAPSHOT.txt
rename to wear/api/27.0.0-SNAPSHOT.txt