Added toKS for XElement
Test: Tested with XConvertersTest
Change-Id: I2c4a2cb3c432bdb789b42f3de9eb77bc47462877
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/compat/XConverters.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/compat/XConverters.kt
index 5269b23..0c6ab9a 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/compat/XConverters.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/compat/XConverters.kt
@@ -55,6 +55,7 @@
import androidx.room.compiler.processing.ksp.KspType
import androidx.room.compiler.processing.ksp.KspTypeElement
import androidx.room.compiler.processing.ksp.synthetic.KspSyntheticPropertyMethodElement
+import com.google.devtools.ksp.symbol.KSAnnotated
import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.KSFunctionDeclaration
@@ -170,6 +171,9 @@
fun XTypeElement.toKS(): KSClassDeclaration = (this as KspTypeElement).declaration
@JvmStatic
+ fun XElement.toKS(): KSAnnotated = (this as KspElement).declaration
+
+ @JvmStatic
fun XExecutableElement.toKS(): KSFunctionDeclaration =
when (this) {
is KspExecutableElement -> this.declaration
@@ -278,4 +282,4 @@
else -> error("Unexpected executable type: $this")
}
}
-}
\ No newline at end of file
+}