feat(ios): give Room a way to construct the database without reflection
`MantraDatabaseConstructor` has been in commonMain all along -- `expect`, `@Suppress`ed for having no actual, and referenced by nothing. Room's KSP only generates the actual when `@ConstructedBy` names the object, so on a target with no reflection there was no way into the database at all. This is the one annotation in the ios work that changes every other target too: the generator now emits an `actual object` for android and jvm as well, each returning `MantraDatabase_Impl()`, where before it emitted none. jvmTest is unmoved at 1174, and MantraDatabaseJvmTest's comment about the no-Context builder overload being available "because MantraDatabaseConstructor gives Room a way to instantiate without reflection" is now true rather than aspirational. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dda2f95c1b
commit
73b2c8ae9a
1 file changed
+2
@@ -2,6 +2,7 @@ package press.mantra.compose.database
|
|||||||
|
|
||||||
import androidx.room3.ColumnTypeConverters
|
import androidx.room3.ColumnTypeConverters
|
||||||
import androidx.room3.AutoMigration
|
import androidx.room3.AutoMigration
|
||||||
|
import androidx.room3.ConstructedBy
|
||||||
import androidx.room3.Database
|
import androidx.room3.Database
|
||||||
import androidx.room3.RoomDatabase
|
import androidx.room3.RoomDatabase
|
||||||
import androidx.room3.immediateTransaction
|
import androidx.room3.immediateTransaction
|
||||||
@@ -366,6 +367,7 @@ val GENESIS_AT = Instant.fromEpochMilliseconds(1231006505000L)
|
|||||||
AutoMigration(from = 21, to = 22),
|
AutoMigration(from = 21, to = 22),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ConstructedBy(MantraDatabaseConstructor::class)
|
||||||
@ColumnTypeConverters(MantraConverters::class)
|
@ColumnTypeConverters(MantraConverters::class)
|
||||||
abstract class MantraDatabase: RoomDatabase() {
|
abstract class MantraDatabase: RoomDatabase() {
|
||||||
abstract fun broadcastNostrEventReceiptDao(): BroadcastNostrEventReceiptDao
|
abstract fun broadcastNostrEventReceiptDao(): BroadcastNostrEventReceiptDao
|
||||||
|
|||||||
Reference in new issue
Block a user