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

New Error Prone 'IgnoredPureGetter' diagnostic #16996

Closed
cushon opened this issue Dec 12, 2022 · 1 comment
Closed

New Error Prone 'IgnoredPureGetter' diagnostic #16996

cushon opened this issue Dec 12, 2022 · 1 comment
Labels
team-Rules-Java Issues for Java rules type: bug

Comments

@cushon
Copy link
Contributor

cushon commented Dec 12, 2022

After 248ff0d, using Bazel and java_tools at head to build Bazel fails:

ERROR: external/com_google_protobuf/java/core/BUILD:112:13: Building external/com_google_protobuf/java/core/liblite_runtime_only.jar (89 source files) [for tool] failed: (Exit 1): java failed: error executing command (from target @com_google_protobuf//java/core:lite_runtime_only) external/remotejdk17_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 17 arguments skipped)
external/com_google_protobuf/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java:785: error: [IgnoredPureGetter] Getters on AutoValues, AutoBuilders, and Protobuf Messages are side-effect free, so there is no point in calling them if the return value is ignored. While there are no side effects from the getter, the receiver may have side effects.
      ((GeneratedMessageLite.ExtendableMessage<?, ?>) message).ensureExtensionsAreMutable();
                                                                                         ^
    (see https://errorprone.info/bugpattern/IgnoredPureGetter)
  Did you mean to remove this line?

This diagnostic should probably not be an error.

copybara-service bot pushed a commit to google/error-prone that referenced this issue Dec 12, 2022
copybara-service bot pushed a commit to google/error-prone that referenced this issue Dec 12, 2022
copybara-service bot pushed a commit to bazelbuild/rules_java that referenced this issue Dec 13, 2022
See bazelbuild/bazel#16996

PiperOrigin-RevId: 494921387
Change-Id: Ie5813469c05684dba89610da94ba3d51a1e919c2
copybara-service bot pushed a commit that referenced this issue Dec 13, 2022
See #16996

PiperOrigin-RevId: 494921387
Change-Id: I53dee7da0f321c50e303816b5fb85eda45949efa
@sgowroji sgowroji added type: bug team-Rules-Java Issues for Java rules labels Dec 13, 2022
@cushon
Copy link
Contributor Author

cushon commented Dec 13, 2022

3b57894

@cushon cushon closed this as completed Dec 13, 2022
Wyverald pushed a commit that referenced this issue Apr 26, 2023
…8225)

* Disable 'IgnoredPureGetter'

See #16996

PiperOrigin-RevId: 494921387
Change-Id: I53dee7da0f321c50e303816b5fb85eda45949efa

* Make LenientFormatStringValidation a warning

PiperOrigin-RevId: 502649182
Change-Id: Ia69e5be9da817d7c25e51cad5086309515bb280a

* Make ReturnMissingNullable a warning

PiperOrigin-RevId: 502710013
Change-Id: I80f35a248623d293e187d481dc5ffbaff08bf25f

* Redirect JVM warnings to stderr in general.

In particular this avoids problems with JVM warnings clashing with the worker protocol, but also matches Blaze's idea of where output goes better.

PiperOrigin-RevId: 524826411
Change-Id: If4c78ac5f63dfd4596da924c12552f6335b8034d

---------

Co-authored-by: Googler <[email protected]>
Co-authored-by: Googler <[email protected]>
Co-authored-by: Googler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-Java Issues for Java rules type: bug
Projects
None yet
Development

No branches or pull requests

2 participants