Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
https://android-review.googlesource.com/1123258
https://goto.google.com/android-sha1/b90079595f33f58fece04026a97faa0d243acdb1
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
Description
Version used: 2.1.0-alpha04
When using a Dao such as:
@Dao
abstract class ItemDao {
@Query("DELETE FROM item")
internal abstract suspend fun deleteAllInternal()
}
I get an IllegalArgumentException from within Room's compiler:
e: [kapt] An exception occurred: java.lang.IllegalArgumentException: index 1 for '$a' not in range (received 0 arguments)
at com.squareup.javapoet.Util.checkArgument(Util.java:64)
at com.squareup.javapoet.CodeBlock$Builder.add(CodeBlock.java:232)
at com.squareup.javapoet.MethodSpec$Builder.addCode(MethodSpec.java:405)
at androidx.room.solver.prepared.binder.CallablePreparedQueryResultBinder$executeAndReturn$callableImpl$1.invoke(CallablePreparedQueryResultBinder.kt:62)
at androidx.room.solver.prepared.binder.CallablePreparedQueryResultBinder$executeAndReturn$callableImpl$1.invoke(CallablePreparedQueryResultBinder.kt:35)
at androidx.room.ext.Javapoet_extKt.CallableTypeSpecBuilder(javapoet_ext.kt:185)
at androidx.room.solver.prepared.binder.CallablePreparedQueryResultBinder.executeAndReturn(CallablePreparedQueryResultBinder.kt:56)
at androidx.room.writer.DaoWriter.createPreparedQueryMethodBody(DaoWriter.kt:155)
at androidx.room.writer.DaoWriter.createPreparedQueries(DaoWriter.kt:134)
at androidx.room.writer.DaoWriter.createTypeSpecBuilder(DaoWriter.kt:92)
at androidx.room.writer.ClassWriter.write(ClassWriter.kt:44)
at androidx.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:77)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:106)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
...
Removing either internal or suspend fixes the issue.