Remove typeutils.erasure & typeutils.isSameType access
Another preliminary step for migration.
typeUtils.erasure(value) -> value.erasure(typeUtils)
typeUtils.isSameType(a, b) -> a.isSameType(typeUtils.b)
After migration, they'll be:
value.erasure()
a.isSameType(b)
Bug: 160323720
Test: existing test suite
Change-Id: I2ec861df430bf38dcd96e08beab7521ec30a4e74
diff --git a/room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt b/room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
index 26f1d6f..02e9725 100644
--- a/room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
@@ -26,6 +26,7 @@
import isAssignableFrom
import isDeclared
import isNotNone
+import isSameType
import java.lang.reflect.Proxy
import java.util.Locale
import javax.annotation.processing.ProcessingEnvironment
@@ -404,7 +405,7 @@
}
ourParams.forEachIndexed { i, variableElement ->
// Plus 1 to their index because their first param is a self object.
- if (!typeUtils.isSameType(theirParams[i + 1].type, variableElement.type)) {
+ if (!theirParams[i + 1].type.isSameType(typeUtils, variableElement.type)) {
return false
}
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/ext/type_mirror_ext.kt b/room/compiler/src/main/kotlin/androidx/room/ext/type_mirror_ext.kt
index e484715..f349a00 100644
--- a/room/compiler/src/main/kotlin/androidx/room/ext/type_mirror_ext.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/ext/type_mirror_ext.kt
@@ -123,4 +123,8 @@
fun TypeMirror.asArray() = MoreTypes.asArray(this)
-fun TypeMirror.asPrimitive() = MoreTypes.asPrimitiveType(this)
\ No newline at end of file
+fun TypeMirror.asPrimitive() = MoreTypes.asPrimitiveType(this)
+
+fun TypeMirror.isSameType(utils: Types, other: TypeMirror) = utils.isSameType(this, other)
+
+fun TypeMirror.erasure(utils: Types) = utils.erasure(this)
\ No newline at end of file
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt b/room/compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt
index c99418d..c17a6bd 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt
@@ -39,6 +39,7 @@
import androidx.room.vo.PrimaryKey
import androidx.room.vo.columnNames
import asTypeElement
+import isSameType
import javax.lang.model.element.Name
import javax.lang.model.element.TypeElement
import javax.lang.model.type.TypeMirror
@@ -159,7 +160,7 @@
}
val defaultType = context.processingEnv.requireTypeMirror(Object::class)
- if (context.processingEnv.typeUtils.isSameType(entityType, defaultType)) {
+ if (entityType.isSameType(context.processingEnv.typeUtils, defaultType)) {
return null
}
val contentEntityElement = entityType.asTypeElement()
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt b/room/compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
index 17e96a1..6046232 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
@@ -43,6 +43,8 @@
import androidx.room.vo.QueryParameter
import androidx.room.vo.ShortcutQueryParameter
import androidx.room.vo.TransactionMethod
+import erasure
+import isSameType
import javax.lang.model.element.ExecutableElement
import javax.lang.model.element.VariableElement
import javax.lang.model.type.DeclaredType
@@ -177,12 +179,10 @@
private val continuationParam: VariableElement by lazy {
val typesUtil = context.processingEnv.typeUtils
- val continuationType = typesUtil.erasure(
- context.processingEnv
- .requireTypeMirror(KotlinTypeNames.CONTINUATION.toString())
- )
+ val continuationType = context.processingEnv
+ .requireTypeMirror(KotlinTypeNames.CONTINUATION.toString()).erasure(typesUtil)
executableElement.parameters.last {
- typesUtil.isSameType(typesUtil.erasure(it.type), continuationType)
+ it.type.erasure(typesUtil).isSameType(typesUtil, continuationType)
}
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt b/room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
index c6614a5..6561b3b 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
@@ -68,6 +68,7 @@
import com.google.auto.value.AutoValue
import isError
import isNotVoid
+import isSameType
import isTypeOf
import isVoid
import javax.lang.model.element.ExecutableElement
@@ -723,7 +724,7 @@
context.checker.check(
success || bindingScope == FieldProcessor.BindingScope.READ_FROM_CURSOR,
field.element, CANNOT_FIND_GETTER_FOR_FIELD)
- if (success && !context.processingEnv.typeUtils.isSameType(field.getter.type, field.type)) {
+ if (success && !field.getter.type.isSameType(context.processingEnv.typeUtils, field.type)) {
// getter's parameter type is not exactly the same as the field type.
// put a warning and update the value statement binder.
context.logger.w(
@@ -791,7 +792,7 @@
context.checker.check(
success || bindingScope == FieldProcessor.BindingScope.BIND_TO_STMT,
field.element, CANNOT_FIND_SETTER_FOR_FIELD)
- if (success && !context.processingEnv.typeUtils.isSameType(field.setter.type, field.type)) {
+ if (success && !field.setter.type.isSameType(context.processingEnv.typeUtils, field.type)) {
// setter's parameter type is not exactly the same as the field type.
// put a warning and update the value reader adapter.
context.logger.w(
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt b/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
index 140872f..118f4eb 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
@@ -24,6 +24,7 @@
import androidx.room.vo.ShortcutQueryParameter
import androidx.room.vo.findFieldByColumnName
import asTypeElement
+import isSameType
import isTypeOf
import javax.lang.model.element.ExecutableElement
import javax.lang.model.element.TypeElement
@@ -92,13 +93,13 @@
params: List<ShortcutQueryParameter>,
onValidatePartialEntity: (Entity, Pojo) -> Unit
) = params.associateBy({ it.name }, { param ->
- if (context.processingEnv.typeUtils.isSameType(targetEntity.type, param.pojoType)) {
+ if (targetEntity.type.isSameType(context.processingEnv.typeUtils, param.pojoType!!)) {
ShortcutEntity(entity = targetEntity, partialEntity = null)
} else {
// Target entity and pojo param are not the same, process and validate partial entity.
val pojo = PojoProcessor.createFor(
context = context,
- element = param.pojoType!!.asTypeElement(),
+ element = param.pojoType.asTypeElement(),
bindingScope = FieldProcessor.BindingScope.BIND_TO_STMT,
parent = null
).process().also { pojo ->
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt b/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt
index d41dfdf..68b011d 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt
@@ -23,6 +23,7 @@
import androidx.room.vo.ShortcutQueryParameter
import asDeclaredType
import asTypeElement
+import erasure
import isAssignableFrom
import isType
import javax.lang.model.element.VariableElement
@@ -88,8 +89,8 @@
throw IllegalArgumentException("iterator() not found in Iterable $iterableType")
}
- val iterableType = typeUtils.erasure(processingEnv
- .requireTypeMirror("java.lang.Iterable"))
+ val iterableType = processingEnv
+ .requireTypeMirror("java.lang.Iterable").erasure(typeUtils)
if (iterableType.isAssignableFrom(typeUtils, typeMirror)) {
val declared = typeMirror.asDeclaredType()
val pojo = extractPojoTypeFromIterator(declared)
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt b/room/compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt
index 6e54796..48b287e 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt
@@ -26,6 +26,7 @@
import androidx.room.ext.isJavaDefault
import androidx.room.ext.isOverrideableIgnoringContainer
import androidx.room.vo.TransactionMethod
+import erasure
import isAssignableFrom
import javax.lang.model.element.ExecutableElement
import javax.lang.model.type.DeclaredType
@@ -48,7 +49,7 @@
executableElement, ProcessorErrors.TRANSACTION_METHOD_MODIFIERS)
val returnType = delegate.extractReturnType()
- val erasureReturnType = typeUtils.erasure(returnType)
+ val erasureReturnType = returnType.erasure(typeUtils)
DEFERRED_TYPES.firstOrNull { className ->
context.processingEnv.findTypeMirror(className)?.let {
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt b/room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
index c32f5c3..d076271 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
@@ -41,6 +41,7 @@
import androidx.room.vo.Pojo
import androidx.room.vo.Warning
import com.google.auto.value.AutoValue.CopyAnnotations
+import isSameType
import javax.lang.model.element.ExecutableElement
import javax.lang.model.element.TypeElement
import javax.lang.model.type.DeclaredType
@@ -91,7 +92,7 @@
it.isStatic() &&
!it.hasAnnotation(Ignore::class) &&
!it.isPrivate() &&
- typeUtils.isSameType(it.returnType, autoValueElement.type)
+ it.returnType.isSameType(typeUtils, autoValueElement.type)
}
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt b/room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
index f2866e2..365e3eb 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
@@ -96,11 +96,13 @@
import asTypeElement
import com.google.common.annotations.VisibleForTesting
import com.google.common.collect.ImmutableList
+import erasure
import isArray
import isAssignableFrom
import isDeclared
import isError
import isNotByte
+import isSameType
import isType
import isTypeOf
import java.util.LinkedList
@@ -278,8 +280,8 @@
else -> {
val types = context.processingEnv.typeUtils
typeConverters.firstOrNull {
- types.isSameType(it.from, converter.to) && types
- .isSameType(it.to, converter.from)
+ it.from.isSameType(types, converter.to) &&
+ it.to.isSameType(types, converter.from)
}
}
}
@@ -388,16 +390,14 @@
if (typeMirror.typeArguments.isEmpty()) {
val rowAdapter = findRowAdapter(typeMirror, query) ?: return null
return SingleEntityQueryResultAdapter(rowAdapter)
- } else if (
- context.processingEnv.typeUtils.erasure(typeMirror).typeName() ==
+ } else if (typeMirror.erasure(context.processingEnv.typeUtils).typeName() ==
GuavaBaseTypeNames.OPTIONAL) {
// Handle Guava Optional by unpacking its generic type argument and adapting that.
// The Optional adapter will reappend the Optional type.
val typeArg = typeMirror.typeArguments.first()
val rowAdapter = findRowAdapter(typeArg, query) ?: return null
return GuavaOptionalQueryResultAdapter(SingleEntityQueryResultAdapter(rowAdapter))
- } else if (
- context.processingEnv.typeUtils.erasure(typeMirror).typeName() ==
+ } else if (typeMirror.erasure(context.processingEnv.typeUtils).typeName() ==
CommonTypeNames.OPTIONAL) {
// Handle java.util.Optional similarly.
val typeArg = typeMirror.typeArguments.first()
@@ -511,7 +511,7 @@
fun findQueryParameterAdapter(typeMirror: TypeMirror): QueryParameterAdapter? {
val typeUtils = context.processingEnv.typeUtils
if (typeMirror.isType() &&
- typeUtils.erasure(context.COMMON_TYPES.COLLECTION).isAssignableFrom(
+ context.COMMON_TYPES.COLLECTION.erasure(typeUtils).isAssignableFrom(
typeUtils,
typeMirror
)) {
@@ -552,7 +552,7 @@
}
val types = context.processingEnv.typeUtils
inputs.forEach { input ->
- if (outputs.any { output -> types.isSameType(input, output) }) {
+ if (outputs.any { output -> input.isSameType(types, output) }) {
return NoOpConverter(input)
}
}
@@ -595,7 +595,7 @@
private fun getAllColumnAdapters(input: TypeMirror): List<ColumnTypeAdapter> {
return columnTypeAdapters.filter {
- context.processingEnv.typeUtils.isSameType(input, it.out)
+ input.isSameType(context.processingEnv.typeUtils, it.out)
}
}
@@ -611,10 +611,10 @@
// for excludes, use exact match
return typeConverters.filter { converter ->
converter.from.isAssignableFrom(types, input) &&
- !excludes.any { types.isSameType(it, converter.to) }
+ !excludes.any { it.isSameType(types, converter.to) }
}.sortedByDescending {
// if it is the same, prioritize
- if (types.isSameType(it.from, input)) {
+ if (it.from.isSameType(types, input)) {
2
} else {
1
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt
index 7c3d918..3e145b1 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt
@@ -25,6 +25,7 @@
import androidx.room.solver.QueryResultBinderProvider
import androidx.room.solver.query.result.CoroutineFlowResultBinder
import androidx.room.solver.query.result.QueryResultBinder
+import erasure
import javax.lang.model.type.DeclaredType
@Suppress("FunctionName")
@@ -63,7 +64,7 @@
if (declared.typeArguments.size != 1) {
return false
}
- val typeName = context.processingEnv.typeUtils.erasure(declared).typeName()
+ val typeName = declared.erasure(context.processingEnv.typeUtils).typeName()
if (typeName in CHANNEL_TYPE_NAMES) {
context.logger.e(ProcessorErrors.invalidChannelType(typeName.toString()))
return false
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceFactoryQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceFactoryQueryResultBinderProvider.kt
index d01d1b8..9f2db8c 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceFactoryQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceFactoryQueryResultBinderProvider.kt
@@ -26,6 +26,7 @@
import androidx.room.solver.query.result.ListQueryResultAdapter
import androidx.room.solver.query.result.PositionalDataSourceQueryResultBinder
import androidx.room.solver.query.result.QueryResultBinder
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -58,7 +59,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
// we don't want to return paged list unless explicitly requested
return erasure.isAssignableFrom(
typeUtils,
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceQueryResultBinderProvider.kt
index fe57782..7cd0505 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/DataSourceQueryResultBinderProvider.kt
@@ -25,6 +25,7 @@
import androidx.room.solver.query.result.ListQueryResultAdapter
import androidx.room.solver.query.result.PositionalDataSourceQueryResultBinder
import androidx.room.solver.query.result.QueryResultBinder
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -59,7 +60,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
val isDataSource = dataSourceTypeMirror!!.isAssignableFrom(
typeUtils,
erasure
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/GuavaListenableFutureQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/GuavaListenableFutureQueryResultBinderProvider.kt
index db574aff..2eabc87 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/GuavaListenableFutureQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/GuavaListenableFutureQueryResultBinderProvider.kt
@@ -25,6 +25,7 @@
import androidx.room.solver.QueryResultBinderProvider
import androidx.room.solver.query.result.GuavaListenableFutureQueryResultBinder
import androidx.room.solver.query.result.QueryResultBinder
+import erasure
import javax.lang.model.type.DeclaredType
@Suppress("FunctionName")
@@ -60,6 +61,6 @@
*/
override fun matches(declared: DeclaredType): Boolean =
declared.typeArguments.size == 1 &&
- context.processingEnv.typeUtils.erasure(declared).typeName() ==
+ declared.erasure(context.processingEnv.typeUtils).typeName() ==
GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt
index ad73e34..320343d 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt
@@ -23,6 +23,7 @@
import androidx.room.solver.query.result.LiveDataQueryResultBinder
import androidx.room.solver.query.result.QueryResultAdapter
import androidx.room.solver.query.result.QueryResultBinder
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -54,7 +55,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
return erasure.isAssignableFrom(typeUtils, liveDataTypeMirror!!)
}
}
\ No newline at end of file
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/PagingSourceQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/PagingSourceQueryResultBinderProvider.kt
index b1e7f97..19b5fb9 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/PagingSourceQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/PagingSourceQueryResultBinderProvider.kt
@@ -28,6 +28,7 @@
import androidx.room.solver.query.result.PositionalDataSourceQueryResultBinder
import androidx.room.solver.query.result.QueryResultBinder
import com.squareup.javapoet.TypeName
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -62,7 +63,7 @@
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
if (!pagingSourceTypeMirror!!.isAssignableFrom(typeUtils, erasure)) {
return false
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxCallableQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxCallableQueryResultBinderProvider.kt
index 0d32121..4725127 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxCallableQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxCallableQueryResultBinderProvider.kt
@@ -23,6 +23,7 @@
import androidx.room.solver.RxType
import androidx.room.solver.query.result.QueryResultBinder
import androidx.room.solver.query.result.RxCallableQueryResultBinder
+import erasure
import javax.lang.model.type.DeclaredType
class RxCallableQueryResultBinderProvider private constructor(
@@ -39,7 +40,7 @@
declared.typeArguments.size == 1 && matchesRxType(declared)
private fun matchesRxType(declared: DeclaredType): Boolean {
- val erasure = context.processingEnv.typeUtils.erasure(declared)
+ val erasure = declared.erasure(context.processingEnv.typeUtils)
return erasure.typeName() == rxType.className
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt
index ee5253c..938deea 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt
@@ -23,6 +23,7 @@
import androidx.room.solver.query.result.QueryResultAdapter
import androidx.room.solver.query.result.QueryResultBinder
import androidx.room.solver.query.result.RxQueryResultBinder
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -58,7 +59,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
return erasure.isAssignableFrom(typeUtils, typeMirror!!)
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt
index 9c3ee1a..8063f81 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt
@@ -28,6 +28,7 @@
import androidx.room.processor.ProcessorErrors
import androidx.room.solver.prepared.binder.CallablePreparedQueryResultBinder.Companion.createPreparedBinder
import androidx.room.solver.prepared.binder.PreparedQueryResultBinder
+import erasure
import javax.lang.model.type.DeclaredType
class GuavaListenableFuturePreparedQueryResultBinderProvider(val context: Context) :
@@ -39,7 +40,7 @@
override fun matches(declared: DeclaredType): Boolean =
declared.typeArguments.size == 1 &&
- context.processingEnv.typeUtils.erasure(declared).typeName() ==
+ declared.erasure(context.processingEnv.typeUtils).typeName() ==
GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
override fun provide(declared: DeclaredType, query: ParsedQuery): PreparedQueryResultBinder {
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt
index 8b3d052..85d7b98 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt
@@ -26,6 +26,7 @@
import androidx.room.solver.RxType
import androidx.room.solver.prepared.binder.CallablePreparedQueryResultBinder.Companion.createPreparedBinder
import androidx.room.solver.prepared.binder.PreparedQueryResultBinder
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -43,7 +44,7 @@
declared.typeArguments.size == 1 && matchesRxType(declared)
private fun matchesRxType(declared: DeclaredType): Boolean {
- val erasure = context.processingEnv.typeUtils.erasure(declared)
+ val erasure = declared.erasure(context.processingEnv.typeUtils)
return erasure.typeName() == rxType.className
}
@@ -88,7 +89,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
return erasure.isAssignableFrom(typeUtils, completableType!!)
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
index 9961244..db4276d 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
@@ -27,6 +27,7 @@
import androidx.room.processor.ProcessorErrors
import androidx.room.solver.shortcut.binder.CallableDeleteOrUpdateMethodBinder.Companion.createDeleteOrUpdateBinder
import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
+import erasure
import javax.lang.model.type.DeclaredType
/**
@@ -42,7 +43,7 @@
override fun matches(declared: DeclaredType): Boolean =
declared.typeArguments.size == 1 &&
- context.processingEnv.typeUtils.erasure(declared).typeName() ==
+ declared.erasure(context.processingEnv.typeUtils).typeName() ==
GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
override fun provide(declared: DeclaredType): DeleteOrUpdateMethodBinder {
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt
index 5f6ea59..82cecb0a 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt
@@ -28,6 +28,7 @@
import androidx.room.solver.shortcut.binder.CallableInsertMethodBinder.Companion.createInsertBinder
import androidx.room.solver.shortcut.binder.InsertMethodBinder
import androidx.room.vo.ShortcutQueryParameter
+import erasure
import javax.lang.model.type.DeclaredType
/**
@@ -43,7 +44,7 @@
override fun matches(declared: DeclaredType): Boolean =
declared.typeArguments.size == 1 &&
- context.processingEnv.typeUtils.erasure(declared).typeName() ==
+ declared.erasure(context.processingEnv.typeUtils).typeName() ==
GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
override fun provide(
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
index 23318bf..98eb7ba 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
@@ -24,6 +24,7 @@
import androidx.room.solver.RxType
import androidx.room.solver.shortcut.binder.CallableDeleteOrUpdateMethodBinder.Companion.createDeleteOrUpdateBinder
import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -46,7 +47,7 @@
declared.typeArguments.size == 1 && matchesRxType(declared)
private fun matchesRxType(declared: DeclaredType): Boolean {
- val erasure = context.processingEnv.typeUtils.erasure(declared)
+ val erasure = declared.erasure(context.processingEnv.typeUtils)
return erasure.typeName() == rxType.className
}
@@ -93,7 +94,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
return erasure.isAssignableFrom(typeUtils, completableTypeMirror!!)
}
}
diff --git a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertMethodBinderProvider.kt b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertMethodBinderProvider.kt
index e5a4765..38258f1 100644
--- a/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertMethodBinderProvider.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertMethodBinderProvider.kt
@@ -25,6 +25,7 @@
import androidx.room.solver.shortcut.binder.CallableInsertMethodBinder.Companion.createInsertBinder
import androidx.room.solver.shortcut.binder.InsertMethodBinder
import androidx.room.vo.ShortcutQueryParameter
+import erasure
import isAssignableFrom
import javax.lang.model.type.DeclaredType
import javax.lang.model.type.TypeMirror
@@ -47,7 +48,7 @@
declared.typeArguments.size == 1 && matchesRxType(declared)
private fun matchesRxType(declared: DeclaredType): Boolean {
- val erasure = context.processingEnv.typeUtils.erasure(declared)
+ val erasure = declared.erasure(context.processingEnv.typeUtils)
return erasure.typeName() == rxType.className
}
@@ -97,7 +98,7 @@
return false
}
val typeUtils = context.processingEnv.typeUtils
- val erasure = typeUtils.erasure(declared)
+ val erasure = declared.erasure(typeUtils)
return erasure.isAssignableFrom(typeUtils, completableTypeMirror!!)
}
}