Slackbot
06/13/2022, 1:03 PMMichal Klimczak
06/14/2022, 9:47 AMjava.lang.IllegalStateException: Unsupported type BookDto at com.squareup.kotlinpoet.metadata.classinspectors.JvmDescriptorTypeVisitor.visitUnknown(JvmDescriptorUtils.kt:191)
. BookDto is a simple data class generated by sqldelight. Then during kapt phase my processor tries to generate a few classes and without correctErrorTypes = false
it generates them with NonExistentClass
and with correctErrorTypes = true
this error. What could that mean?
The line that causes it in the processor:
val typeSpec = (element as TypeElement).toTypeSpec(classInspector)
Also it's random. From time to time it builds just fine, but 80% of the time it fails.
(kotlinpoet 1.10 and 1.11, kotlin 1.6.21, sqldelight 1.5.3, full exception in thread)jw
06/17/2022, 11:39 AMalec
06/17/2022, 4:35 PMjw
06/18/2022, 8:37 PMAidan Low
06/21/2022, 8:56 PMawaitItem()
I seem to see each individual time the StateFlow was set, but what I care about is the eventual value after a number of operations. It manifests most painfully in my combine-heavy view model with a lot of .stateIn()
operations but can also be seen in
val stateFlow = MutableStateFlow(false)
stateFlow.test {
stateFlow.value = true
val a = awaitItem() // this is false
val b = awaitItem() // this is true
}
jw
06/21/2022, 9:00 PMAidan Low
06/21/2022, 9:04 PM.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(),
initialValue = emptyList()
)
and I was hoping to use turbine to manage subscription to the flows so that they would update properly. Is there a recommended pattern to do that so that I can assert on the value despite the subscription requirement?jw
06/21/2022, 9:06 PMAidan Low
06/21/2022, 9:07 PMAidan Low
06/22/2022, 12:00 AMfun TestScope.observeStateFlows(
vararg stateFlows: StateFlow<Any?>,
block: () -> Unit
) {
val observationJobs = stateFlows.map { flow ->
launch {
flow.collect {}
}
}
try {
runCurrent()
block.invoke()
} finally {
observationJobs.forEach { it.cancel() }
}
}
ephemient
06/22/2022, 4:45 AMcoroutineScope {
for (flow in flows) flow.launchIn(this)
coroutineContext.cancelChildren()
Javier
06/23/2022, 12:47 PMjw
06/23/2022, 12:49 PMJavier
06/23/2022, 12:58 PMJavier
06/23/2022, 12:59 PMjw
06/23/2022, 1:00 PMJavier
06/23/2022, 1:10 PMjw
06/23/2022, 1:14 PMkrzysztof
06/23/2022, 1:16 PMCREATE TABLE IF NOT EXISTS example_table(
key TEXT NOT NULL UNIQUE PRIMARY KEY,
value TEXT
);
In sql, you can do something like
INSERT INTO example_table (key, value)
VALUES ("k1", "v1"), ("k2", "v2")
How can I create such query, so that I can pass a list of my key-value
entries? Such as
db.insertMany(listOf(Entry(k1, v1), Entry(k2, v2)))
?brabo-hi
06/23/2022, 8:55 PMinsert
or update
if exist ?Daniel Bucher
06/24/2022, 10:37 AMSaiedmomen
06/25/2022, 9:12 AMjava.sql.SQLSyntaxErrorException: Table 'backend_db.record' doesn't exist
CREATE TABLE record(
date_time TEXT NOT NULL,
value INTEGER NOT NULL
);
insert:
INSERT INTO record (date_time, value) VALUES (?, ?);
selectRecords:
SELECT * FROM record;
Is it expected behavior or am I missing sth in my setup?
val hikariConfig: HikariConfig = HikariConfig("/hikari.properties").apply {
validate()
}
val hikariDataSource: DataSource = HikariDataSource(hikariConfig)
val driver: SqlDriver = hikariDataSource.asJdbcDriver()
val db = Database(driver)
Also if it is expected behavior, what is the tool to use to initialize the db based on schema?hfhbd
06/25/2022, 9:49 AMJaime
06/25/2022, 11:24 PMExecution failed for task ':app:mergeExtDexDevDebug'.
> Could not resolve all files for configuration ':app:devDebugRuntimeClasspath'.
> Failed to transform compiler-api-2.4.0.jar (com.squareup.anvil:compiler-api:2.4.0) to match attributes {artifactType=android-dex, asm-transformed-variant=devDebug, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
> Could not resolve all files for configuration ':app:devDebugRuntimeClasspath'.
> Failed to transform kotlin-compiler-embeddable-1.6.10.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.10) to match attributes {artifactType=android-asm-instrumented-jars, asm-transformed-variant=devDebug, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AsmClassesTransform: /Users/mac/.gradle/caches/transforms-3/13fb0caefbd9f3c68d6e998f61bcf48b/transformed/jetified-kotlin-compiler-embeddable-1.6.10.jar.
> JSR/RET are not supported with computeFrames option
> Failed to transform kotlin-compiler-embeddable-1.6.10.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.10) to match attributes {artifactType=android-dex, asm-transformed-variant=devDebug, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AsmClassesTransform: /Users/mac/.gradle/caches/transforms-3/13fb0caefbd9f3c68d6e998f61bcf48b/transformed/jetified-kotlin-compiler-embeddable-1.6.10.jar.
> JSR/RET are not supported with computeFrames option
hfhbd
06/26/2022, 6:15 PMCodeBlock.of("${CodeBlock.of("foo")}.bar")
? This calls CodeBlock.toString()
and results into wrong imports. You must use CodeBlock.of("%L.bar", CodeBlock.of("foo"))
to keep the arguments of the inner CodeBlock.Sean Proctor
06/28/2022, 12:58 PMkrzysztof
06/29/2022, 3:11 PMQueries can be performed using SQLiteDatabase query or rawQuery methods only
from Android driver, either if I run is as labeled statement or just type it in my .sq
schemaKy
06/29/2022, 5:54 PMNo suitable driver found for jdbc:sqlite:
java.sql.SQLException: No suitable driver found for jdbc:sqlite:
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
This only happens when I run all the tests in a gradle task. If i run the tests individually it works. One thought is to just keep retrying the connection, how could I do this?
ThanksAidan Low
06/30/2022, 5:57 PMfromJson()
, augment the resulting class with the new pair, and then call toJson()
again?