Java: overriding getter on a record results in "reference to <getter> is ambiguous #22105
Labels
team-Rules-Java
Issues for Java rules
turbine
Issues related to https://github.com/google/turbine
type: bug
untriaged
Description of the bug:
This is similar to #17181
According to Oracle's docs (see the section "Explicit Declaration of Record Class Members"), redefining a getter on a Java record should override the default implementation.
For example:
However, when I try to build this with Bazel, I get
error: reference to <getter> is ambiguous
. In contrast, the build succeeds as expected with Maven.My .bazelrc options:
common --java_language_version=17 --java_runtime_version=local_jdk_17 --tool_java_language_version=17 --tool_java_runtime_version=local_jdk_17
I also tried importing the latest
java_tools
release into my WORKSPACE file to fix this, based on the resolution inhttps://github.com/bazelbuild/bazel/issues/17181
, but I'm still seeing this error.Which category does this issue belong to?
Java Rules
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create one java_library with a record that overrides a getter, as demonstrated above.
Create another java_library with a source that tries to use that getter.
Which operating system are you running Bazel on?
ubuntu 22.04.1
What is the output of
bazel info release
?release 7.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
Uncertain, we have not used Bazel to build this code before.
Have you found anything relevant by searching the web?
#17181
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: