ursus
08/11/2025, 1:12 PMInfo: Unexpected error while reading XYZ's kotlin.Metadata: element 'k' is missing.
Internet says to -keep class kotlin.Metadata { *; }
, about which I'm unsure about
I never had to mess with kotlin's default proguard keep rules
Should I do it? Anyone else experiencing it?Colton Idle
08/11/2025, 1:28 PMKelvin Chung
08/11/2025, 3:26 PMinterface Extender<T> {
context(thisValue: T)
fun doSomething()
}
class Foo : Extender<Foo> {
context(thisValue: Foo)
override fun doSomething() { ... }
// So, Foo would need a context-free overload of doSomething() anyways
// passing itself as context, in order for outsiders to use it?
fun doSomething() = context(this) { doSomething() }
}
Eric Joseph
08/11/2025, 5:52 PMMatt Kessler
08/12/2025, 11:37 AMKelvin Chung
08/13/2025, 12:12 AMinterface MyType
value class Wrapper(value: Int) : MyType, WrapperAddOp
interface WrapperAddOp : MyType {
operator fun plus(rhs: Wrapper): Wrapper = // default implementation
}
When I try to run a test (JVM), I get a NoSuchMethodError
when I try to invoke the plus
method on Wrapper
, saying that a mangled name starting with plus
on Wrapper
doesn't exist. Anyone with any insights on this?Rafael Costa
08/13/2025, 9:52 AMfun bar(
lambda: context(String) () -> Unit
) {
with("") {
lambda()
}
}
fun foo() {
bar {
this // error
}
}
Am I missing something? Is this not supposed to give me a string?
I am not able to get the context parameter of the lambda in any way. If I try bar { str ->
then "str" here is also an error 🤔Jeff Hudson
08/13/2025, 7:56 PMCyclicBarrier
is really nice, but using it from Kotlin is not nice, since it's not coroutine-friendly.
I've searched high and low, and haven't found a good alternative other than to roll my own. Has anyone run into this?Colton Idle
08/14/2025, 12:45 PMDaniel Pitts
08/14/2025, 3:44 PMThe inner `None` object, used in the `Maybe` class to represent an absent value, is defined using `data object`. Although this is suitable for describing uniqueness and immutability, `data object` is over-specified here, as it incurs unnecessary memory allocation inefficiency compared to plain `object`. Consider replacing `data object None` with `object None`.
This seems like its wrong...Vivek Modi
08/18/2025, 12:58 PMCLOVIS
08/18/2025, 1:48 PMKotlin: Argument type mismatch: actual type is 'Select<CapturedType(out Record!)#1>', but 'Select<out CapturedType(out Record!)#2!>!' was expected.
This is triggered by the code:
val a: Select<out Record?> = TODO()
val b: Select<out Record?> = TODO()
a.unionAll(b)
where Select
is declared in Java:
public interface Select<R extends Record>
extends
ResultQuery<R>,
TableLike<R>,
FieldLike,
FieldOrRowOrSelect
{
@NotNull @CheckReturnValue
@Support
Select<R> unionAll(Select<? extends R> select);
}
Shouldn't <? extends R>
allow R
itself?Hunter
08/18/2025, 4:33 PMvalue class
as a vararg
parameter. Is there a reason for this? I don't understand why this would be a limitation.purezen
08/18/2025, 6:36 PMpurezen
08/18/2025, 6:36 PMViewModel
librarypurezen
08/18/2025, 6:37 PMColton Idle
08/18/2025, 6:44 PMfun
and then putting a log statement. It works just takes a while.Robert Jaros
08/19/2025, 2:03 PMAdam S
08/20/2025, 5:15 AMval
, not a var
?
sealed interface ParentType
class SubTypeA : ParentType
class SubTypeB : ParentType
sealed interface DataHolder1 {
var data: ParentType
// ERROR: Type of 'data' doesn't match the type of the overridden 'var' property 'var data: ParentType' defined in 'DataHolder1'.
class HolderA(override var data: SubTypeA) : DataHolder1
// ERROR: Type of 'data' doesn't match the type of the overridden 'var' property 'var data: ParentType' defined in 'DataHolder1'.
class HolderB(override var data: SubTypeB) : DataHolder1
}
sealed interface DataHolder2 {
val data: ParentType
// but the type of `val` properties can be changed?
class HolderA(override val data: SubTypeA) : DataHolder2
class HolderB(override val data: SubTypeB) : DataHolder2
}
https://pl.kotl.in/esiw_FX5Htimrijckaert
08/20/2025, 2:24 PM-Xcontext-receivers
with -Xcontext-parameters
and resynced.
I don't get to see the new inspection.
Neither in the latest Android Studio stable/beta nor IntelliJ Ultimate.
What am I missing?
IntelliJ IDEA 2025.2 (Ultimate Edition)
Build #IU-252.23892.409, built on August 1, 2025
Source revision: 0a9a69b3f9332
Nicolai C.
08/21/2025, 3:51 AMExample
and manually implement example1
I can reference example2
just fine, which puzzles me as to why the following snippet doesn't compile.
val example = Example {
// this is without `example1`
example2() // this line doesn't compile
}
fun interface Example {
fun example1()
fun example2() {
println("Example")
}
}
Teodora Mihaila
08/21/2025, 10:12 AMCaused by: java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.buildtools.api.jvm.ClasspathEntrySnapshot org.jetbrains.kotlin.buildtools.api.CompilationService.calculateClasspathSnapshot(java.io.File, org.jetbrains.kotlin.buildtools.api.jvm.ClassSnapshotGranularity, boolean)'
Mi Re
08/21/2025, 12:18 PMProfileScreen
, my app navigates to AuthScreen
using the signOut()
callback passed as a constructor argument to ProfileScreen
.
After that, my AuthViewModel
collects authService.currentUser
the same way it’s done in ProfileViewModel
inside the init
block.
However, it still returns a non-null FirebaseUser
, even though I already signed out.
I’ll attach some code in a reply. Thanks in advance!Fernando
08/22/2025, 3:25 PMrobstoll
08/25/2025, 9:43 AMfoo(f: context(users: UserService) Bar.() -> Unit)
bazbo.222
08/25/2025, 4:24 PMfoo(arg)
, foo(arg)
gets calculated, but the second, third etc. times that I call foo
after that, foo(arg)
just returns the already computed, stored value.
E.g. in Python, this exists in the form of the @Memoize
operator, if anyone is familiar with that.
Is there any way to achieve this in Kotlin or should I just implement the memoization mechanism myself.Joshua Hansen
08/25/2025, 10:55 PMfun main() {
val book = Book("Kotlin Basics", List(10) { Page(it + 1) })
val p = book.pages[4] // get the fullName from this scope given `book` and `p`?
}
class Book(val name: String, val pages: List<Page>) {
val Page.fullName: String
get() = "$name: Page $number of ${pages.size}"
}
class Page(val number: Int)
Huib Donkers
08/26/2025, 11:13 AMcrossinline
, forbids the non-local return, but I can no longer initialize member `val`s from the lambda. I can initialize member `var`s, and local `val`s. See playground example here. I don't understand why initializing member val
would no longer be possible.
◦ When trying to initialize a member val
kotlin 1.9.25 errors "Captured values initialization is forbidden due to possible reassignment" (is the contract not understood here?) and kotlin 2 errors "Initialization of captured member values must be inlined" (is it not inlined?)y
08/26/2025, 11:37 AMCannot invoke "java.util.Map.get(Object)" because the return value of foo() is null
very naively: foo()
is a Kotlin function which returns List<Bar>
, so under what conditions could it even return null?