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

Fail to compile Java stubs in mixed-kotlin/Java setting #1059

Open
pettermahlen opened this issue Oct 23, 2023 · 0 comments
Open

Fail to compile Java stubs in mixed-kotlin/Java setting #1059

pettermahlen opened this issue Oct 23, 2023 · 0 comments

Comments

@pettermahlen
Copy link
Contributor

This feels like a pretty obscure corner case, but in the following situation:

  1. A Bazel package with mixed Java and Kotlin sources, where the Java code references the Kotlin code, and
  2. A java-based (not sure if that's a necessary condition) plugin that doesn't generate any source code (not sure if that's a necessary condition).

Then the Compiling Java headers (building the -java-hjar.jar file) fails to compile the Java code with an error like error: could not resolve <AnyClassDefinedInKotlin>.

I think the issue is in how the dependencies for the Java stubs compilation is set up here and here. In the second case, the .abi.jar, which contains class file definitions from Kotlin, is added, and the build works. In my case, I seem to be hitting the first situation, and the build doesn't work because the ABI jar is missing from the classpath (instead, there is a kapt-generated-stub.jar file at the corresponding place in the classpath). I don't understand that code well enough to actually propose a solution.

The reason I ran into this is that I'm doing a blanket add of a Dagger SPI plugin across a wide range of builds when a given flag is enabled. SPI plugins get loaded by Dagger only when Dagger runs so I thought it it should be a no-op for packages where Dagger isn't used. But that's not the case, it actually breaks building as described above.

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

No branches or pull requests

1 participant