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

AutoValue/AutoFactory generated code not indexed by Intellij when syncing Kotlin libraries #6657

Open
ianb-pomelo opened this issue Aug 22, 2024 · 2 comments
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: IntelliJ IntelliJ plugin type: bug

Comments

@ianb-pomelo
Copy link

Description of the bug:

We have imported the AutoValue and AutoFactory plugins into our Kotlin Bazel workspace and it build and generates things as expected. However, Intellij is not indexing the generated classes and thus they appear unresolved. I have checked the build output and the classes are in the lib.jar and the lib-java.jar but not in the lib-kt.jar.

Which category does this issue belong to?

Intellij

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Import this repo and try to sync. The sync succeeds but TestFileFactory is unresolved.

Which Intellij IDE are you using? Please provide the specific version.

IntelliJ IDEA 2024.2.0.2 Build #IU-242.20224.419

What programming languages and tools are you using? Please provide specific versions.

Kotlin 1.7

What Bazel plugin version are you using?

2024.07.30.0.2-api-version-242

Have you found anything relevant by searching the web?

This has been occurring for a long time so not a regression. We've been able to write out own KAPT plugins that generate code and Intellij indexes those so as far as I can tell it is just these Auto* plugins

Any other information, logs, or outputs that you want to share?

No response

@ianb-pomelo ianb-pomelo added awaiting-maintainer Awaiting review from Bazel team on issues type: bug labels Aug 22, 2024
@github-actions github-actions bot added the product: IntelliJ IntelliJ plugin label Aug 22, 2024
@agluszak agluszak assigned agluszak and unassigned mai93 Oct 5, 2024
@agluszak
Copy link
Collaborator

agluszak commented Oct 5, 2024

Are you sure that your repro is correct? For me your code does not compile

andrzej.gluszak@pl-unit-004 ~/c/i/intellij-sync-issue (main)> bazel build //...
INFO: Analyzed 2 targets (2 packages loaded, 7 targets configured).
INFO: From Building external/rules_jvm_external/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/libzip.jar (1 source file) [for tool]:
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
INFO: From Building external/rules_jvm_external/private/tools/java/com/github/bazelbuild/rules_jvm_external/librules_jvm_external.jar (4 source files) [for tool]:
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
INFO: From Building external/rules_jvm_external/private/tools/java/com/github/bazelbuild/rules_jvm_external/jar/AddJarManifestEntry.jar (1 source file) [for tool]:
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
ERROR: /home/andrzej.gluszak/code/ij_repros/intellij-sync-issue/BUILD:14:15: Building test-java.jar (1 source jar) and running annotation processors (AutoFactoryProcessor) failed: (Exit 1): java failed: error executing Javac command (from target //:test) external/rules_java~~toolchains~remotejdk21_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 19 arguments skipped)
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
bazel-out/k8-fastbuild/bin/_javac/test/test-java_tmp/TestFileFactory.java:2: error: package javax.inject does not exist
import javax.inject.Inject;
                   ^
bazel-out/k8-fastbuild/bin/_javac/test/test-java_tmp/TestFileFactory.java:9: error: cannot find symbol
  @Inject
   ^
  symbol:   class Inject
  location: class TestFileFactory
Target //:test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.423s, Critical Path: 1.10s
INFO: 13 processes: 5 internal, 3 linux-sandbox, 5 worker.
ERROR: Build did NOT complete successfully
andrzej.gluszak@pl-unit-004 ~/c/i/intellij-sync-issue (main) [1]> bazel --version
bazel 7.3.2

@ianb-pomelo
Copy link
Author

Ah yea thanks, missing a dependency. I've pushed a fix that builds successfully for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: IntelliJ IntelliJ plugin type: bug
Projects
None yet
Development

No branches or pull requests

3 participants