Zac Sweers
12/17/2025, 3:56 AMdmitriy.novozhilov
12/17/2025, 8:41 AMContainer annotation is repeatable, but it's missing on the classpath, so fir2ir cannot find an IrConstructorSymbol to generate the IrConstructorCall.
So I kinda can justify the existing behavior.dmitriy.novozhilov
12/17/2025, 8:46 AMContributesBinding.Container doesn't exist?
If yes, that what does it mean?
if it's not accessible, check if it's aConsider some default implementation for any missing annotation namedContainer
Container?Milosz Piekutowski
12/17/2025, 10:29 AMclassId. Translating such annotations to the IR will be pretty straightforward then.
Until these changes are introduced, please provide all required annotations in dependencies.Zac Sweers
12/17/2025, 3:22 PMZac Sweers
12/17/2025, 3:22 PMdmitriy.novozhilov
12/17/2025, 3:26 PMContributesBinding.Container appeared in the metadata (so it was deserialized this way by the frontend)?Zac Sweers
12/17/2025, 3:27 PMZac Sweers
12/17/2025, 3:28 PMdmitriy.novozhilov
12/17/2025, 3:31 PMZac Sweers
12/17/2025, 3:35 PMdmitriy.novozhilov
12/17/2025, 3:35 PM@Ann(1)
@Ann(2)
class Some
These @Ann(1) and @Ann(2) come from sources?Zac Sweers
12/17/2025, 3:36 PMZac Sweers
12/17/2025, 3:36 PMdmitriy.novozhilov
12/17/2025, 3:36 PMZac Sweers
12/17/2025, 3:37 PM@Ann.Container([
Ann(1),
Ann(2)
])
class SomeZac Sweers
12/17/2025, 3:39 PMContainer nested classZac Sweers
12/17/2025, 3:40 PMContainer for this reasonudalov
But how it happened that theThere's noappeared in the metadata (so it was deserialized this way by the frontend)?ContributesBinding.Container
Container in metadata, and in fact there are no annotations in metadata until KT-75736. When we load annotations from the JVM bytecode though, we detect Container class and unwrap repeated annotations here: https://github.com/JetBrains/kotlin/blob/88ed6bcf257eeb0aa2693626a237c00f102550f9/[…]rains/kotlin/load/kotlin/AbstractBinaryClassAnnotationLoader.kt
Looks like if we cannot resolve the Container class, we will not be able to unwrap it and the unresolved annotation will remain as @Container(...).
So I'm not sure how we can help with issue except for KT-75736.Zac Sweers
12/17/2025, 6:06 PMudalov
Zac Sweers
12/17/2025, 6:08 PMZac Sweers
12/17/2025, 6:08 PMudalov
Zac Sweers
12/17/2025, 6:10 PMudalov
Zac Sweers
12/17/2025, 6:12 PMZac Sweers
12/17/2025, 6:12 PMZac Sweers
12/17/2025, 6:13 PMZac Sweers
12/17/2025, 6:13 PMZac Sweers
12/17/2025, 6:22 PMudalov
ContributesBinding.Container exist?Zac Sweers
12/17/2025, 6:27 PMZac Sweers
12/17/2025, 6:28 PMudalov
ContributesBinding.Container does not exist. How does it happen that ContributesBinding exists, but ContributesBinding.Container does not? The compiler assumes that repeatable annotation and its container are compiled togetherZac Sweers
12/17/2025, 6:32 PMZac Sweers
12/17/2025, 6:33 PMZac Sweers
12/17/2025, 6:34 PMudalov
Container is a synthetic class from the Kotlin metadata's point of view, so maybe something filters it out, and that's where the root issue is, I think.Zac Sweers
12/17/2025, 6:40 PMZac Sweers
12/17/2025, 6:40 PMudalov
the inferred approachIf the compiler sees
@X.Container(X(), X()) and it doesn't have the class file for X.Container, how do you suggest it infer that in reality it's @X @X? There can be a user-defined annotation named Container in X, that is not the repeatable container for X.
I mean, we can check the value of @java.lang.annotation.Repeatable on X and infer that X.Container is its repeatable container. This should work fine, but it's a bit strange because it only helps the case when X exists in dependencies and X.Container is not, which is not the Kotlin compiler's problem. And also I'm not sure that's what you're suggesting. :)Zac Sweers
12/17/2025, 6:45 PMContainer as a name does seem to be a magic constant for JVM (at least since kotlin doesn't support a custom one like Java’s)Zac Sweers
12/17/2025, 6:46 PMZac Sweers
12/17/2025, 6:47 PMZac Sweers
12/17/2025, 6:48 PMudalov
(at least since kotlin doesn't support a custom one like Java’s)Kotlin does support custom containers: https://github.com/Kotlin/KEEP/blob/master/proposals/repeatable-annotations.md#proposal
udalov
If null, check if simple name is Container and if it has an outer class ID(Btw, don't get me started on trying to obtain outer class ID from the JVM internal name. 😄 Since we load annotations from the JVM bytecode, we only see
pkg/X$Container and we cannot assume that it's a nested class for pkg/X, because both in Java and in Kotlin, you could declare a top level class named X$Container.)udalov
Zac Sweers
12/17/2025, 7:57 PMJvmRepeatableZac Sweers
12/17/2025, 7:58 PMdmitriy.novozhilov
12/18/2025, 8:14 AMAbstractBinaryClassAnnotationAndConstantLoader as it's descriptor-speicifc. I suppose that back in 2021 we were not that focused on fir productization to fix KT-48131 there too and then just missed the bug in K2.
So the conclusion that there is actually a bug in the frontend.