Construct java_common with explicit fields (#388)

`java_common` is currently the result of an unannotated factory. [sty](https://github.com/tamird/sty) loses its field types at that boundary: `java_common.BootClassPathInfo` becomes unknown instead of a provider key, and `java_common.compile` loses its callable signature.

Construct the unconditional fields directly in `struct(...)` and collect conditional fields in a helper. The field values, conditions, and evaluation order are preserved. A downstream sty check now resolves the provider key and callable signature.

Prepared with OpenAI Codex.

Closes #388

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/388 from tamird:codex/sty-ratchet-java-common-fields ddd484a4dc5e46879bca1df691f6648fa274d63d
PiperOrigin-RevId: 1033360418
Change-Id: I42811aa436dca932577afaec76c993d6692e1589
1 file changed
tree: cf508f7c6fbf059ed73047eb83af8d1263ea9faf
  1. .bazel_checkout/
  2. .bazelci/
  3. .bcr/
  4. .github/
  5. distro/
  6. examples/
  7. java/
  8. test/
  9. third_party/
  10. toolchains/
  11. .bazelignore
  12. .bazelrc
  13. .gitignore
  14. AUTHORS
  15. BUILD
  16. CODEOWNERS
  17. CONTRIBUTING.md
  18. LICENSE
  19. MODULE.bazel
  20. README.md
  21. renovate.json
  22. WORKSPACE
  23. WORKSPACE.bzlmod
README.md

rules_java

Build status

Java Rules for Bazel https://bazel.build.

Documentation

For a quickstart tutorial, see https://bazel.build/start/java

The fastest way to try this in an empty project is to click the green “Use this template” button on https://github.com/bazel-starters/java.

For slightly more advanced usage, like setting up toolchains or writing your own java-like rules, see https://bazel.build/docs/bazel-and-java

Core Java rules

Add a load like:

load("@rules_java//java:java_library.bzl", "java_library")

to your BUILD / BUILD.bazel / *.bzl files

For detailed docs on the core rules, see https://bazel.build/reference/be/java