Hi everyone, I'm generating Kotlin/Native C bindi...
# compiler
r
Hi everyone, I'm generating Kotlin/Native C bindings using KotlinPoet and marking APIs with custom Opt-in annotations for version-specific C library features. My bindings are complex, with many interdependent modules and a deep hierarchy. To simplify, I opt-in to all ~200 annotations across all modules. This worked fine in Kotlin 2.0, but after upgrading to 2.1, I'm getting hundreds of warnings like:
w: Opt-in requirement marker org.gtkkn.bindings.webkit.annotations.WebKitVersion2_8 is unresolved. Please make sure it's present in the module dependencies.
I know the ideal solution is to opt-in only to the necessary annotations, but this isn't simple as they are generated dynamically using GObject introspection, which varies by library version on the host system. Is there a way to suppress this specific opt-in warning at the module level, or are there other approaches to handle this? Thanks!
d
There is a mechanism for global warning suppression (
-Xsuppress-warning=WARNING_NAME
), but it won't work for this one, as this warning is unnamed Could you please create a ticket for this usecase? cc @mglukhikh
r
@mglukhikh using opt-in in a module is exactly why I have the issue: if you look at the error, is not complaining that I haven't opted-in to something but that I'm opting-in to unresolved marker. Like I said, this wasn't an issue for Kotlin 2.0 but it is for 2.1.
My bindings are complex, with many interdependent modules and a deep hierarchy. To simplify, I opt-in to all ~200 annotations across all modules.
So the issue is that in some modules I'm opting-in to markers that are not available as dependency. I know, it is not correct, but it worked in 2.0 and, since the marker are part of generated code, I can't simply hard-code them manually for each module. The workaround I found is to move all the annotations on a dedicated module and add this module as dependency, this way they can always be resolved. But I was wondering if there is another solution.
m
Well, then, again, please create a ticket.