Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown enum constant DeprecationLevel #8194

Open
c-eg opened this issue Jan 14, 2024 · 8 comments
Open

Unknown enum constant DeprecationLevel #8194

c-eg opened this issue Jan 14, 2024 · 8 comments
Labels
bug Bug in existing code

Comments

@c-eg
Copy link

c-eg commented Jan 14, 2024

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
...
@c-eg c-eg added the bug Bug in existing code label Jan 14, 2024
@yschimke
Copy link
Collaborator

yschimke commented Jan 14, 2024

Same as gradle/kotlin-dsl-samples#1301 and
square/okio#562

I can check we have this as API

@yschimke
Copy link
Collaborator

@palexdev
Copy link

Any update on this? Is there a way to suppress it? pretty annoying

@c-eg
Copy link
Author

c-eg commented Apr 3, 2024

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.

@yschimke
Copy link
Collaborator

yschimke commented Apr 6, 2024

@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?

@c-eg
Copy link
Author

c-eg commented Apr 6, 2024

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?

kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "org-jetbrains-kotlin" }

@yschimke
Copy link
Collaborator

yschimke commented Apr 6, 2024

This is above my head. Feel free to submit a PR.

@swankjesse might know the fix.

@c-eg
Copy link
Author

c-eg commented Apr 6, 2024

I forked and built locally, adding the import statement, and then published to maven local; but it didn't fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

3 participants