dokka: Could not read file exception with 1.8.10 + java 18
wDescribe the bug I am migrating my android library project to kotlin 1.8.10, but I started getting this exception:
Could not read file: /nvme/buildkite/builds/8192mb-4096cpu-android_603ae6562927_fc6092f/instacart/instacart-design-system-android/legacy-core/build/intermediates/compile_library_classes_jar/release/classes.jar!/com/instacart/design/itemcard/ItemCard.class; size in bytes: 3691; file type: CLASS
--
| java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
Expected behaviour
Not crashing would be very nice and polite
To Reproduce It seems to occur when a module refers to classes from another module (and both of these modules use dokka)
Dokka configuration
Kotlin 1.8.10
OpenJDK 64-Bit Server VM Zulu18.32+13-CA
Installation
- Operating system: macOS/Linux
- Build tool: Gradle 8.0.2, happens on both CI and locally
- Dokka version: 1.8.10 (I have another error if I try to only downgrade dokka to 1.7.20)
Additional context
Are you willing to provide a PR? Potentially yes, I might need some guidance to pinpoint the source thoug
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 8
- Comments: 15 (2 by maintainers)
Commits related to this issue
- [gradle] Remove dokka plugin Summary: This is currently breaking our jetpack-compose build and blocks the entire release as a consequence: https://github.com/facebook/flipper/issues/4970 There are a... — committed to facebook/flipper by deleted user a year ago
- Remove dokka plugin (#4995) Summary: [gradle] Remove dokka plugin This is currently breaking our jetpack-compose build and blocks the entire release as a consequence: https://github.com/facebook/flip... — committed to facebook/flipper by deleted user a year ago
- ci: disable dokka on compose projects for now caused by https://github.com/Kotlin/dokka/issues/2956 — committed to inovait/kotlinova by matejdro 9 months ago
- Downgrade JDK to 11 To address https://github.com/Kotlin/dokka/issues/2956 — committed to saket/telephoto by saket 4 months ago
Just updated a project to AGP 8.1.1 and Kotlin 1.9.10 and getting the same error when I try to
publishToMavenLocal. We aren’t using anything fancy, justmaven-publishplugin,We’re running into this issue too, but I’m not convinced it’s purely a Dokka issue. The step that fails during execution,
com.android.build.gradle.tasks.JavaDocGenerationTask$DokkaWorkAction, looks to come from AGP. And it still errors after removing Dokka related plugins, Gradle tasks, etc.I’ve tried creating a minimal repo that recreates this, but I haven’t had any luck yet. All of the files that it shows in the errors. are sealed classes, but not all sealed classes are erroring.
I see the same error like @nate-eisner with Java 17 installed.
AGP 8.0.0 is stable now so we are now there.
If you have this problem, you can temporarily disable this task. In my case this happened during maven publishing, I disabled this task and it worked fine.
interesting, so we have had more time to dig into this as we need to find a solution to adopt compose 1.5. We made some updates to our project -> Compile SDK 34 + Java 18 + Kotlin 1.8.22 + paparazzi 1.3.0 + AGP 8.1 + vanniktech publish plugin 0.25.3
This has allowed us to dig deeper into the doc generation as we still see this issue.
we are indeed using
javaDocReleaseGeneration(via the vanniktech publish plugin)our `solution’ has been to disable this task for the one specific module where this happens This is an old part of our library we don’t really care about, so this is an acceptable compromise to unblock the updates. The weird thing is that there isn’t anything that remarkable about this module. it depends on other modules, but so do other parts of our library, without causing this issue.
So I have tried to use
dokkaHtmlMultiModuleinstead, if only to help understand what’s happening. This works! My suspicion is that we are hitting a variation of https://github.com/Kotlin/dokka/issues/1833We will investigate further and decided whether to contribute a fix at the vanniktech level or to migrate to our own internal publish plugin (we already have one, still incubating). Hard to know for sure without digging more into its codebase, but I think that the core issue is due to how vanniktech declares dependencies between modules.
Thanks for researching it!
This is interesting. Are you using a task called
javaDocReleaseGeneration? Does it come from AGP? If yes, then you are not really using Dokka (at least not directly), as Dokka’s tasks aredokkaHtmlanddokkaHtmlMultiModule.AGP 7.1 did start bundling a very old version Dokka, which led to a bunch of compatibility problems for existing Dokka users (see #2472), so here there might be a similar problem here.
Judging by the stacktrace, it looks like the version of the kotlin compiler used to generate the docs does not support Java 18. If AGP bundles a very outdated version of Dokka, no wonder!
I’ve just tried running Dokka with Java 19, and it works just fine:
Log:
So it might be an upstream bug of AGP.
Can you share which task you’re using just to make sure?
I tried to toggle more features on/off it turns out that I don’t have this exception if I set the project’s java language level to 11 (instead of 18 previously) both jdkVersion.set(x) for dokka and
for compilation modules
reverting to 11 is something we would really like NOT to have to do though. Among other things because JDK 17 will soon be necessary to run the android gradle plugin