Unknown enum constant DeprecationLevel
After adding OkHttp3 (4.12.0), with Gradle (8.3) and JDK (17.0.7 Corretto), I get the following warnings appear when running gradle build:
...
> Task :compileJava
warning: unknown enum constant DeprecationLevel.ERROR
reason: class file for kotlin.DeprecationLevel not found
...
Same as https://github.com/gradle/kotlin-dsl-samples/issues/1301 and https://github.com/square/okio/issues/562
I can check we have this as API
It looks like we maybe didn't declare an api dependency in 4.x
https://github.com/square/okhttp/blob/parent-4.12.0/okhttp/build.gradle#L24-L25
while we do for
https://github.com/square/okhttp/blob/parent-5.0.0-alpha.12/okhttp/build.gradle.kts#L91-L94
Any update on this? Is there a way to suppress it? pretty annoying
I have just tried again with version 5.0.0-alpha.12, and the warning messages still appear.
It's worth noting that adding requires kotlin.stdlib to your module-info.java will stop the warnings from showing.
@c-eg I think we are using Automatic-Module-Name here https://github.com/square/okhttp/blob/master/okhttp/build.gradle.kts#L54
We don't have a module-info. Should we add an import there?
I'm not familiar with OSGi, but after a quick look through some documentation, it seems like that might be the necessary fix.
Another thing, the Kotlin documentation for OSGi states
It is recommended to remove kotlin-runtime, kotlin-stdlib and kotlin-reflect dependencies as kotlin-osgi-bundle already contains all of them.
which okhttp3 does not do, maybe this could be addressed at the same time? https://github.com/square/okhttp/blob/dba8478dff0d2492d9d7bfe9c9471b6b3cdb6002/gradle/libs.versions.toml#L68
This is above my head. Feel free to submit a PR.
@swankjesse might know the fix.
I forked and built locally, adding the import statement, and then published to maven local; but it didn't fix the issue.